public RemoteUrl(String url, List<String> serverList) { this.url = url; this.serverList = serverList; for (String server : serverList) { try { if (!server.startsWith("http://")) { if (server.startsWith("https://")) { } else { server = "http://" + server; } } urls.add(new URL(server + url)); } catch (MalformedURLException e) { LOGGER.error(e.toString()); } } }
@Override public URL getRemoteHost() { try { return new URL(getCloudTestingServiceUrl()); } catch (MalformedURLException e) { logger.error(e.toString(), e); getGa().trackException(e); } return null; }
private MagicCommandOutcomeItem handleMvnLocal() { String localRepo = BeakerxSystemProperty.getHomeUser() + "/.m2/repository"; if (Files.exists(Paths.get(localRepo))) { ClasspathAddMvnMagicCommand mvnMagicCommand = kernel.magicCommandConfiguration().getClasspathAddMvnMagicCommand(kernel); try { String result = mvnMagicCommand.addRepo(MVN_LOCAL, new File(localRepo).toURI().toURL().toString()); return createResult(result); } catch (MalformedURLException e) { return new MagicCommandOutput(Status.ERROR, e.toString()); } } return new MagicCommandOutput(Status.OK, String.format("Warning: directory %s not found", localRepo)); }
throw new NullPointerException(e.toString());
/** * Convert an array of string paths to an array of URLs * * @param paths the string paths * @return the converted URLs */ public URL[] toURLs(String... paths) { URL[] urls = new URL[paths.length]; int i = 0; for (String path : paths) { try { urls[i++] = new File(path).toURI().toURL(); } catch (MalformedURLException e) { Assert.fail(e.toString()); } } return urls; }
commandHost.fail("JMX Connection failed: " + e.toString(), e); } catch (IOException e) { commandHost.fail("JMX Connection failed: " + e.toString(), e);
private Resource getFileAttributeResource() { // Paths are relative to the build file they're imported from, // *not* the current directory (same as entity includes). if (file != null) { if (isExistingAbsoluteFile(file)) { return new FileResource(FILE_UTILS.normalize(file)); } File buildFile = new File(getLocation().getFileName()).getAbsoluteFile(); if (buildFile.exists()) { File buildFileParent = new File(buildFile.getParent()); File importedFile = FILE_UTILS.resolveFile(buildFileParent, file); return new FileResource(importedFile); } // maybe this import tasks is inside an imported URL? try { URL buildFileURL = new URL(getLocation().getFileName()); URL importedFile = new URL(buildFileURL, file); return new URLResource(importedFile); } catch (MalformedURLException ex) { log(ex.toString(), Project.MSG_VERBOSE); } throw new BuildException("failed to resolve %s relative to %s", file, getLocation().getFileName()); } return null; }
gazetteerURL = new URL(gazetteer.toString() + "&placename=" + place); } catch (MalformedURLException e) { results.error(feature, e.toString());
@Override public URL buildUrl() throws ClientException { try { return new URL("http://" + metadataServiceHost + URL_IN_ECS_METADATA + roleName); } catch (MalformedURLException e) { throw new IllegalArgumentException(e.toString()); } }
@Override public URL buildUrl() throws ClientException { try { return new URL(ossAuthServerHost); } catch (MalformedURLException e) { throw new IllegalArgumentException(e.toString()); } }
@Override public URL buildUrl() throws ClientException { try { return new URL("http://" + metadataServiceHost + URL_IN_ECS_METADATA + roleName); } catch (MalformedURLException e) { throw new IllegalArgumentException(e.toString()); } }
@Override public URL buildUrl() throws ClientException { try { return new URL("http://" + metadataServiceHost + URL_IN_ECS_METADATA + roleName); } catch (MalformedURLException e) { throw new IllegalArgumentException(e.toString()); } }
private void setCredentialUrl() { try { this.credentialUrl = new URL("http://" + metadataServiceHost + URL_IN_ECS_METADATA + roleName); } catch (MalformedURLException e) { throw new IllegalArgumentException(e.toString()); } }
@Override public URL buildUrl() throws ClientException { try { return new URL(ossAuthServerHost); } catch (MalformedURLException e) { throw new IllegalArgumentException(e.toString()); } }
public Object convert( final String value, final TypeLiteral<?> toType ) { try { return new URL( value ); } catch ( final MalformedURLException e ) { throw new ProvisionException( e.toString() ); } } }
@Override public URL getURL() { try { return new URL("file:" + path); } catch (MalformedURLException e) { Assertions.UNREACHABLE(e.toString()); return null; } }
public Object convert( final String value, final TypeLiteral<?> toType ) { try { return new URL( value ); } catch ( final MalformedURLException e ) { throw new ProvisionException( e.toString() ); } } }
protected URL genURL(String path) { URL url = null; String urlString = URL_SCHEME_COLON + path; try { url = new URL(null, urlString, new Handler()); } catch (MalformedURLException mue) { LOG.warning(mue.toString()); } return url; } }
public String getHref() { String relativeLocation = getAttributeWithNoDefault( "href" ); if (relativeLocation.indexOf( ':' ) > 0 || relativeLocation.equals( "#" )) { return relativeLocation; } else { try { return new URL( ((HTMLDocumentImpl) getOwnerDocument()).getBaseUrl(), relativeLocation ).toExternalForm(); } catch (MalformedURLException e) { return e.toString(); } } }
public String getHref() { try { return new URL( ((HTMLDocumentImpl) getOwnerDocument()).getWindow().getUrl(), getAttributeWithNoDefault( "href" ) ).toExternalForm(); } catch (MalformedURLException e) { return e.toString(); } }