java.net.MalformedURLException.toString()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中java.net.MalformedURLException.toString()方法的一些代码示例,展示了MalformedURLException.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MalformedURLException.toString()方法的具体详情如下:
包路径:java.net.MalformedURLException
类名称:MalformedURLException
方法名:toString

MalformedURLException.toString介绍

暂无

代码示例

代码示例来源:origin: knightliao/disconf

  1. public RemoteUrl(String url, List<String> serverList) {
  2. this.url = url;
  3. this.serverList = serverList;
  4. for (String server : serverList) {
  5. try {
  6. if (!server.startsWith("http://")) {
  7. if (server.startsWith("https://")) {
  8. } else {
  9. server = "http://" + server;
  10. }
  11. }
  12. urls.add(new URL(server + url));
  13. } catch (MalformedURLException e) {
  14. LOGGER.error(e.toString());
  15. }
  16. }
  17. }

代码示例来源:origin: zalando/zalenium

  1. @Override
  2. public URL getRemoteHost() {
  3. try {
  4. return new URL(getCloudTestingServiceUrl());
  5. } catch (MalformedURLException e) {
  6. logger.error(e.toString(), e);
  7. getGa().trackException(e);
  8. }
  9. return null;
  10. }

代码示例来源:origin: twosigma/beakerx

  1. private MagicCommandOutcomeItem handleMvnLocal() {
  2. String localRepo = BeakerxSystemProperty.getHomeUser() + "/.m2/repository";
  3. if (Files.exists(Paths.get(localRepo))) {
  4. ClasspathAddMvnMagicCommand mvnMagicCommand = kernel.magicCommandConfiguration().getClasspathAddMvnMagicCommand(kernel);
  5. try {
  6. String result = mvnMagicCommand.addRepo(MVN_LOCAL, new File(localRepo).toURI().toURL().toString());
  7. return createResult(result);
  8. } catch (MalformedURLException e) {
  9. return new MagicCommandOutput(Status.ERROR, e.toString());
  10. }
  11. }
  12. return new MagicCommandOutput(Status.OK, String.format("Warning: directory %s not found", localRepo));
  13. }

代码示例来源:origin: robovm/robovm

  1. throw new NullPointerException(e.toString());

代码示例来源:origin: spring-projects/spring-loaded

  1. /**
  2. * Convert an array of string paths to an array of URLs
  3. *
  4. * @param paths the string paths
  5. * @return the converted URLs
  6. */
  7. public URL[] toURLs(String... paths) {
  8. URL[] urls = new URL[paths.length];
  9. int i = 0;
  10. for (String path : paths) {
  11. try {
  12. urls[i++] = new File(path).toURI().toURL();
  13. }
  14. catch (MalformedURLException e) {
  15. Assert.fail(e.toString());
  16. }
  17. }
  18. return urls;
  19. }

代码示例来源:origin: aragozin/jvm-tools

  1. commandHost.fail("JMX Connection failed: " + e.toString(), e);
  2. } catch (IOException e) {
  3. commandHost.fail("JMX Connection failed: " + e.toString(), e);

代码示例来源:origin: org.apache.ant/ant

  1. private Resource getFileAttributeResource() {
  2. // Paths are relative to the build file they're imported from,
  3. // *not* the current directory (same as entity includes).
  4. if (file != null) {
  5. if (isExistingAbsoluteFile(file)) {
  6. return new FileResource(FILE_UTILS.normalize(file));
  7. }
  8. File buildFile =
  9. new File(getLocation().getFileName()).getAbsoluteFile();
  10. if (buildFile.exists()) {
  11. File buildFileParent = new File(buildFile.getParent());
  12. File importedFile =
  13. FILE_UTILS.resolveFile(buildFileParent, file);
  14. return new FileResource(importedFile);
  15. }
  16. // maybe this import tasks is inside an imported URL?
  17. try {
  18. URL buildFileURL = new URL(getLocation().getFileName());
  19. URL importedFile = new URL(buildFileURL, file);
  20. return new URLResource(importedFile);
  21. } catch (MalformedURLException ex) {
  22. log(ex.toString(), Project.MSG_VERBOSE);
  23. }
  24. throw new BuildException("failed to resolve %s relative to %s",
  25. file, getLocation().getFileName());
  26. }
  27. return null;
  28. }

代码示例来源:origin: geotools/geotools

  1. gazetteerURL = new URL(gazetteer.toString() + "&placename=" + place);
  2. } catch (MalformedURLException e) {
  3. results.error(feature, e.toString());

代码示例来源:origin: aliyun/aliyun-oss-java-sdk

  1. @Override
  2. public URL buildUrl() throws ClientException {
  3. try {
  4. return new URL("http://" + metadataServiceHost + URL_IN_ECS_METADATA + roleName);
  5. } catch (MalformedURLException e) {
  6. throw new IllegalArgumentException(e.toString());
  7. }
  8. }

代码示例来源:origin: aliyun/aliyun-oss-java-sdk

  1. @Override
  2. public URL buildUrl() throws ClientException {
  3. try {
  4. return new URL(ossAuthServerHost);
  5. } catch (MalformedURLException e) {
  6. throw new IllegalArgumentException(e.toString());
  7. }
  8. }

代码示例来源:origin: com.aliyun.oss/aliyun-sdk-oss

  1. @Override
  2. public URL buildUrl() throws ClientException {
  3. try {
  4. return new URL("http://" + metadataServiceHost + URL_IN_ECS_METADATA + roleName);
  5. } catch (MalformedURLException e) {
  6. throw new IllegalArgumentException(e.toString());
  7. }
  8. }

代码示例来源:origin: com.aliyun.openservices/tablestore

  1. @Override
  2. public URL buildUrl() throws ClientException {
  3. try {
  4. return new URL("http://" + metadataServiceHost + URL_IN_ECS_METADATA + roleName);
  5. } catch (MalformedURLException e) {
  6. throw new IllegalArgumentException(e.toString());
  7. }
  8. }

代码示例来源:origin: com.aliyun/aliyun-java-sdk-core

  1. private void setCredentialUrl() {
  2. try {
  3. this.credentialUrl = new URL("http://" + metadataServiceHost + URL_IN_ECS_METADATA + roleName);
  4. } catch (MalformedURLException e) {
  5. throw new IllegalArgumentException(e.toString());
  6. }
  7. }

代码示例来源:origin: com.aliyun.oss/aliyun-sdk-oss

  1. @Override
  2. public URL buildUrl() throws ClientException {
  3. try {
  4. return new URL(ossAuthServerHost);
  5. } catch (MalformedURLException e) {
  6. throw new IllegalArgumentException(e.toString());
  7. }
  8. }

代码示例来源:origin: org.sonatype.sisu.inject/guice-bean-converters

  1. public Object convert( final String value, final TypeLiteral<?> toType )
  2. {
  3. try
  4. {
  5. return new URL( value );
  6. }
  7. catch ( final MalformedURLException e )
  8. {
  9. throw new ProvisionException( e.toString() );
  10. }
  11. }
  12. }

代码示例来源:origin: wala/WALA

  1. @Override
  2. public URL getURL() {
  3. try {
  4. return new URL("file:" + path);
  5. } catch (MalformedURLException e) {
  6. Assertions.UNREACHABLE(e.toString());
  7. return null;
  8. }
  9. }

代码示例来源:origin: com.atlassian.org.eclipse.sisu/org.eclipse.sisu.inject

  1. public Object convert( final String value, final TypeLiteral<?> toType )
  2. {
  3. try
  4. {
  5. return new URL( value );
  6. }
  7. catch ( final MalformedURLException e )
  8. {
  9. throw new ProvisionException( e.toString() );
  10. }
  11. }
  12. }

代码示例来源:origin: apache/cxf

  1. protected URL genURL(String path) {
  2. URL url = null;
  3. String urlString = URL_SCHEME_COLON + path;
  4. try {
  5. url = new URL(null, urlString, new Handler());
  6. } catch (MalformedURLException mue) {
  7. LOG.warning(mue.toString());
  8. }
  9. return url;
  10. }
  11. }

代码示例来源:origin: httpunit/httpunit

  1. public String getHref() {
  2. String relativeLocation = getAttributeWithNoDefault( "href" );
  3. if (relativeLocation.indexOf( ':' ) > 0 || relativeLocation.equals( "#" )) {
  4. return relativeLocation;
  5. } else {
  6. try {
  7. return new URL( ((HTMLDocumentImpl) getOwnerDocument()).getBaseUrl(), relativeLocation ).toExternalForm();
  8. } catch (MalformedURLException e) {
  9. return e.toString();
  10. }
  11. }
  12. }

代码示例来源:origin: httpunit/httpunit

  1. public String getHref() {
  2. try {
  3. return new URL( ((HTMLDocumentImpl) getOwnerDocument()).getWindow().getUrl(), getAttributeWithNoDefault( "href" ) ).toExternalForm();
  4. } catch (MalformedURLException e) {
  5. return e.toString();
  6. }
  7. }

相关文章