Java Code Examples for java.net.MalformedURLException#toString()
The following examples show how to use
java.net.MalformedURLException#toString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleMapProcessor.java From scipio-erp with Apache License 2.0 | 6 votes |
protected static Map<String, MapProcessor> getProcessors(String xmlResource, String name, ClassLoader loader) throws MiniLangException { Map<String, MapProcessor> simpleMapProcessors = simpleMapProcessorsResourceCache.get(xmlResource); if (simpleMapProcessors == null) { URL xmlURL = null; try { xmlURL = FlexibleLocation.resolveLocation(xmlResource, loader); } catch (MalformedURLException e) { throw new MiniLangException("Could not find SimpleMapProcessor XML document in resource: " + xmlResource + "; error was: " + e.toString(), e); } if (xmlURL == null) { throw new MiniLangException("Could not find SimpleMapProcessor XML document in resource: " + xmlResource); } simpleMapProcessors = simpleMapProcessorsResourceCache.putIfAbsentAndGet(xmlResource, getAllProcessors(xmlURL)); } return simpleMapProcessors; }
Example 2
Source File: ProtobufReader.java From sql-layer with GNU Affero General Public License v3.0 | 6 votes |
private void loadSQLJJars(String schema, Collection<AISProtobuf.SQLJJar> pbJars) { for (AISProtobuf.SQLJJar pbJar : pbJars) { hasRequiredFields(pbJar); try { SQLJJar sqljJar = SQLJJar.create(destAIS, schema, pbJar.getJarName(), new URL(pbJar.getUrl())); if (pbJar.hasVersion()) { sqljJar.setVersion(pbJar.getVersion()); } } catch (MalformedURLException ex) { throw new ProtobufReadException( pbJar.getDescriptorForType().getFullName(), ex.toString() ); } } }
Example 3
Source File: VMWareCloudClientFactory.java From teamcity-vmware-plugin with Apache License 2.0 | 6 votes |
@NotNull protected VMWareApiConnector createConnectorFromParams(@NotNull final CloudState state, CloudClientParameters params){ String serverUrl = params.getParameter(VMWareWebConstants.SERVER_URL); String username = params.getParameter(VMWareWebConstants.USERNAME); String password = params.getParameter(VMWareWebConstants.SECURE_PASSWORD); boolean forceTrustManager = "true".equalsIgnoreCase(params.getParameter(VMWareWebConstants.FORCE_TRUST_MANAGER)); if (serverUrl != null && username != null) { try { return VmwareApiConnectorsPool.getOrCreateConnector( new URL(serverUrl), username, password, myServerSettings.getServerUUID(), state.getProfileId(), myInstancesProvider, mySslTrustStoreProvider); } catch (MalformedURLException e) { LOG.warnAndDebugDetails(e.toString(), e); throw new CloudException("Unable to connect to vCenter: " + e.toString()); } } throw new CloudException("Unable to connect to vCenter: please check connection parameters" ); }
Example 4
Source File: SystemOptionTest.java From netbeans with Apache License 2.0 | 5 votes |
public URL getZ() { try { return new URL((String)((Cell)getProperty("z")).o); } catch (MalformedURLException mfue) { throw new IllegalStateException(mfue.toString()); } }
Example 5
Source File: HTMLAnchorElementImpl.java From lams with GNU General Public License v2.0 | 5 votes |
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(); } } }
Example 6
Source File: HTMLAreaElementImpl.java From lams with GNU General Public License v2.0 | 5 votes |
public String getHref() { try { return new URL( ((HTMLDocumentImpl) getOwnerDocument()).getWindow().getUrl(), getAttributeWithNoDefault( "href" ) ).toExternalForm(); } catch (MalformedURLException e) { return e.toString(); } }
Example 7
Source File: SimpleMethod.java From scipio-erp with Apache License 2.0 | 5 votes |
private static Map<String, SimpleMethod> getSimpleMethods(String xmlResource, ClassLoader loader) throws MiniLangException { Assert.notNull("xmlResource", xmlResource); URL xmlURL = null; try { xmlURL = FlexibleLocation.resolveLocation(xmlResource, loader); } catch (MalformedURLException e) { throw new MiniLangException("Could not find SimpleMethod XML document in resource: " + xmlResource + "; error was: " + e.toString(), e); } if (xmlURL == null) { throw new MiniLangException("Could not find SimpleMethod XML document in resource: " + xmlResource); } return getAllSimpleMethods(xmlURL); }
Example 8
Source File: InstanceProfileCredentialsFetcher.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 5 votes |
@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()); } }
Example 9
Source File: HttpTransactionQueryBase.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Construct a new URL from base and relative components * @param baseComponent Base URL - the relative URL is added to this * @param relativeComponent A partial (or full) URL that represents our target * @return A full URL composed of the relative URL combined with "missing" * portions taken from the base */ public URL newFullUrl(String baseComponent, String relativeComponent) { try { URL baseUrl = new URL(baseComponent); return new URL(baseUrl, relativeComponent); } catch (MalformedURLException exception) { throw new SearchException(exception.toString()); } }
Example 10
Source File: HttpTransactionQueryBase.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Produce a target URL for this query by combining an anchor "href" value * with the base URL of the query page * @param anchor Anchor element */ public void setUrlFromAnchor(Element anchor) throws SearchException { String href = anchor.getAttribute("href"); try { setUrl(newFullUrl(_transaction.getBaseUrlSpecification(), href)); } catch (MalformedURLException exception) { throw new SearchException(exception.toString()); } }
Example 11
Source File: HttpTransactionQueryBase.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Produce a target URL for this query by combining the form "action" value * with the base URL of the query page * @param pageDocument The search engine query page (as a DOM Document) * @param formName The name of the FORM to lookup * (eg <code>FORM name="formName"</code>) */ public void setUrlFromForm(Document pageDocument, String formName) throws SearchException { Element form; if ((form = getFormElement(pageDocument, formName)) == null) { throw new SearchException("No such form: " + formName); } try { setUrl(newFullUrl(_transaction.getBaseUrlSpecification(), form.getAttribute("action"))); } catch (MalformedURLException exception) { throw new SearchException(exception.toString()); } }
Example 12
Source File: JarHandler.java From j2objc with Apache License 2.0 | 5 votes |
/** * * @param url * URL the context URL * @param spec * java.lang.String the spec string * @param start * int the location to start parsing from * @param limit * int the location where parsing ends */ @Override protected void parseURL(URL url, String spec, int start, int limit) { String file = url.getFile(); if (file == null) { file = ""; } if (limit > start) { spec = spec.substring(start, limit); } else { spec = ""; } if (spec.indexOf("!/") == -1 && (file.indexOf("!/") == -1)) { throw new NullPointerException("Cannot find \"!/\""); } if (file.isEmpty()) { file = spec; } else if (spec.charAt(0) == '/') { file = file.substring(0, file.indexOf('!') + 1) + spec; } else { int idx = file.indexOf('!'); String tmpFile = file.substring(idx + 1, file.lastIndexOf('/') + 1) + spec; tmpFile = UrlUtils.canonicalizePath(tmpFile, true); file = file.substring(0, idx + 1) + tmpFile; } try { // check that the embedded url is valid new URL(file); } catch (MalformedURLException e) { throw new NullPointerException(e.toString()); } setURL(url, "jar", "", -1, null, null, file, null, null); }
Example 13
Source File: HttpTransactionQueryBase.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Construct a new URL from base and relative components * @param baseComponent Base URL - the relative URL is added to this * @param relativeComponent A partial (or full) URL that represents our target * @return A full URL composed of the relative URL combined with "missing" * portions taken from the base */ public URL newFullUrl(String baseComponent, String relativeComponent) { try { URL baseUrl = new URL(baseComponent); return new URL(baseUrl, relativeComponent); } catch (MalformedURLException exception) { throw new SearchException(exception.toString()); } }
Example 14
Source File: HttpTransactionQueryBase.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Produce a target URL for this query by combining an anchor "href" value * with the base URL of the query page * @param anchor Anchor element */ public void setUrlFromAnchor(Element anchor) throws SearchException { String href = anchor.getAttribute("href"); try { setUrl(newFullUrl(_transaction.getBaseUrlSpecification(), href)); } catch (MalformedURLException exception) { throw new SearchException(exception.toString()); } }
Example 15
Source File: HttpTransactionQueryBase.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Produce a target URL for this query by combining the form "action" value * with the base URL of the query page * @param pageDocument The search engine query page (as a DOM Document) * @param formName The name of the FORM to lookup * (eg <code>FORM name="formName"</code>) */ public void setUrlFromForm(Document pageDocument, String formName) throws SearchException { Element form; if ((form = getFormElement(pageDocument, formName)) == null) { throw new SearchException("No such form: " + formName); } try { setUrl(newFullUrl(_transaction.getBaseUrlSpecification(), form.getAttribute("action"))); } catch (MalformedURLException exception) { throw new SearchException(exception.toString()); } }
Example 16
Source File: ClasspathAddRepoMagicCommand.java From beakerx with Apache License 2.0 | 5 votes |
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)); }