本文整理了Java中java.net.MalformedURLException.initCause()
方法的一些代码示例,展示了MalformedURLException.initCause()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MalformedURLException.initCause()
方法的具体详情如下:
包路径:java.net.MalformedURLException
类名称:MalformedURLException
方法名:initCause
暂无
代码示例来源:origin: spring-projects/spring-framework
/**
* Create a new {@code UrlResource} based on a URI specification.
* <p>The given parts will automatically get encoded if necessary.
* @param protocol the URL protocol to use (e.g. "jar" or "file" - without colon);
* also known as "scheme"
* @param location the location (e.g. the file path within that protocol);
* also known as "scheme-specific part"
* @param fragment the fragment within that location (e.g. anchor on an HTML page,
* as following after a "#" separator)
* @throws MalformedURLException if the given URL specification is not valid
* @see java.net.URI#URI(String, String, String)
*/
public UrlResource(String protocol, String location, @Nullable String fragment) throws MalformedURLException {
try {
this.uri = new URI(protocol, location, fragment);
this.url = this.uri.toURL();
this.cleanedUrl = getCleanedUrl(this.url, this.uri.toString());
}
catch (URISyntaxException ex) {
MalformedURLException exToThrow = new MalformedURLException(ex.getMessage());
exToThrow.initCause(ex);
throw exToThrow;
}
}
代码示例来源:origin: org.springframework/spring-core
/**
* Create a new {@code UrlResource} based on a URI specification.
* <p>The given parts will automatically get encoded if necessary.
* @param protocol the URL protocol to use (e.g. "jar" or "file" - without colon);
* also known as "scheme"
* @param location the location (e.g. the file path within that protocol);
* also known as "scheme-specific part"
* @param fragment the fragment within that location (e.g. anchor on an HTML page,
* as following after a "#" separator)
* @throws MalformedURLException if the given URL specification is not valid
* @see java.net.URI#URI(String, String, String)
*/
public UrlResource(String protocol, String location, @Nullable String fragment) throws MalformedURLException {
try {
this.uri = new URI(protocol, location, fragment);
this.url = this.uri.toURL();
this.cleanedUrl = getCleanedUrl(this.url, this.uri.toString());
}
catch (URISyntaxException ex) {
MalformedURLException exToThrow = new MalformedURLException(ex.getMessage());
exToThrow.initCause(ex);
throw exToThrow;
}
}
代码示例来源:origin: square/okhttp
malformedUrl.initCause(e);
throw malformedUrl;
代码示例来源:origin: org.netbeans.api/org-openide-awt
e.initCause(iaE);
throw e;
代码示例来源:origin: org.jdom/jdom
mx.initCause(ioe);
throw mx;
代码示例来源:origin: org.apache.servicemix.jbi/org.apache.servicemix.jbi.deployer
/**
* Creates an MalformedURLException with a message and a cause.
*
* @param message exception message
* @param cause exception cause
* @throws MalformedURLException the created MalformedURLException
*/
private static void throwAsMalformedURLException(final String message, final Exception cause)
throws MalformedURLException {
final MalformedURLException exception = new MalformedURLException(message);
exception.initCause(cause);
throw exception;
}
代码示例来源:origin: org.ops4j.pax.url/pax-url-wrap
/**
* Creates an MalformedURLException with a message and a cause.
*
* @param message exception message
* @param cause exception cause
*
* @throws MalformedURLException the created MalformedURLException
*/
private static void throwAsMalformedURLException( final String message, final Exception cause )
throws MalformedURLException
{
final MalformedURLException exception = new MalformedURLException( message );
exception.initCause( cause );
throw exception;
}
代码示例来源:origin: com.tagtraum/qtsampledsp-java
public QTURL(final URL url) throws MalformedURLException {
this.actualURL = url;
try {
this.originalURL = new URL(url.toURI().toASCIIString());
} catch (URISyntaxException e) {
final MalformedURLException exception = new MalformedURLException(url.toString());
exception.initCause(e);
throw exception;
}
}
代码示例来源:origin: com.sun.xml.ws/rt
public static URL getEncodedURL(String urlStr) throws MalformedURLException {
URL url = new URL(urlStr);
String scheme = String.valueOf(url.getProtocol()).toLowerCase();
if (scheme.equals("http") || scheme.equals("https")) {
try {
return new URL(url.toURI().toASCIIString());
} catch (URISyntaxException e) {
MalformedURLException malformedURLException = new MalformedURLException(e.getMessage());
malformedURLException.initCause(e);
throw malformedURLException;
}
}
return url;
}
代码示例来源:origin: com.sun.xml.ws/jaxws-rt
public static URL getEncodedURL(String urlStr) throws MalformedURLException {
URL url = new URL(urlStr);
String scheme = String.valueOf(url.getProtocol()).toLowerCase();
if (scheme.equals("http") || scheme.equals("https")) {
try {
return new URL(url.toURI().toASCIIString());
} catch (URISyntaxException e) {
MalformedURLException malformedURLException = new MalformedURLException(e.getMessage());
malformedURLException.initCause(e);
throw malformedURLException;
}
}
return url;
}
代码示例来源:origin: javaee/metro-jax-ws
public static URL getEncodedURL(String urlStr) throws MalformedURLException {
URL url = new URL(urlStr);
String scheme = String.valueOf(url.getProtocol()).toLowerCase();
if (scheme.equals("http") || scheme.equals("https")) {
try {
return new URL(url.toURI().toASCIIString());
} catch (URISyntaxException e) {
MalformedURLException malformedURLException = new MalformedURLException(e.getMessage());
malformedURLException.initCause(e);
throw malformedURLException;
}
}
return url;
}
代码示例来源:origin: com.android.tools/common
@NonNull
public static File urlToFile(@NonNull URL url) throws MalformedURLException {
try {
return new File(url.toURI());
}
catch (IllegalArgumentException e) {
MalformedURLException ex = new MalformedURLException(e.getLocalizedMessage());
ex.initCause(e);
throw ex;
}
catch (URISyntaxException e) {
return new File(url.getPath());
}
}
代码示例来源:origin: org.apache.activemq/activemq-optional
protected Transport createTransport(URI location, WireFormat wf) throws MalformedURLException {
// need to remove options from uri
URI uri;
try {
uri = URISupport.removeQuery(location);
} catch (URISyntaxException e) {
MalformedURLException cause = new MalformedURLException("Error removing query on " + location);
cause.initCause(e);
throw cause;
}
return new HttpsClientTransport(asTextWireFormat(wf), uri);
}
}
代码示例来源:origin: org.apache.activemq/activemq-optional
protected Transport createTransport(URI location, WireFormat wf) throws IOException {
TextWireFormat textWireFormat = asTextWireFormat(wf);
// need to remove options from uri
URI uri;
try {
uri = URISupport.removeQuery(location);
} catch (URISyntaxException e) {
MalformedURLException cause = new MalformedURLException("Error removing query on " + location);
cause.initCause(e);
throw cause;
}
return new HttpClientTransport(textWireFormat, uri);
}
代码示例来源:origin: org.apache.activemq/activemq-all
@Override
protected Transport createTransport(URI location, WireFormat wf) throws IOException {
TextWireFormat textWireFormat = asTextWireFormat(wf);
// need to remove options from uri
URI uri;
try {
uri = URISupport.removeQuery(location);
} catch (URISyntaxException e) {
MalformedURLException cause = new MalformedURLException("Error removing query on " + location);
cause.initCause(e);
throw cause;
}
return new HttpClientTransport(textWireFormat, uri);
}
代码示例来源:origin: org.apache.activemq/activemq-osgi
@Override
protected Transport createTransport(URI location, WireFormat wf) throws IOException {
TextWireFormat textWireFormat = asTextWireFormat(wf);
// need to remove options from uri
URI uri;
try {
uri = URISupport.removeQuery(location);
} catch (URISyntaxException e) {
MalformedURLException cause = new MalformedURLException("Error removing query on " + location);
cause.initCause(e);
throw cause;
}
return new HttpClientTransport(textWireFormat, uri);
}
代码示例来源:origin: org.apache.activemq/activemq-http
@Override
protected Transport createTransport(URI location, WireFormat wf) throws MalformedURLException {
// need to remove options from uri
URI uri;
try {
uri = URISupport.removeQuery(location);
} catch (URISyntaxException e) {
MalformedURLException cause = new MalformedURLException("Error removing query on " + location);
cause.initCause(e);
throw cause;
}
return new HttpsClientTransport(asTextWireFormat(wf), uri);
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
@Override
protected Transport createTransport(URI location, WireFormat wf) throws MalformedURLException {
// need to remove options from uri
URI uri;
try {
uri = URISupport.removeQuery(location);
} catch (URISyntaxException e) {
MalformedURLException cause = new MalformedURLException("Error removing query on " + location);
cause.initCause(e);
throw cause;
}
return new HttpsClientTransport(asTextWireFormat(wf), uri);
}
}
代码示例来源:origin: org.apache.activemq/activemq-http
@Override
protected Transport createTransport(URI location, WireFormat wf) throws IOException {
TextWireFormat textWireFormat = asTextWireFormat(wf);
// need to remove options from uri
URI uri;
try {
uri = URISupport.removeQuery(location);
} catch (URISyntaxException e) {
MalformedURLException cause = new MalformedURLException("Error removing query on " + location);
cause.initCause(e);
throw cause;
}
return new HttpClientTransport(textWireFormat, uri);
}
代码示例来源:origin: org.apache.activemq/activemq-osgi
@Override
protected Transport createTransport(URI location, WireFormat wf) throws MalformedURLException {
// need to remove options from uri
URI uri;
try {
uri = URISupport.removeQuery(location);
} catch (URISyntaxException e) {
MalformedURLException cause = new MalformedURLException("Error removing query on " + location);
cause.initCause(e);
throw cause;
}
return new HttpsClientTransport(asTextWireFormat(wf), uri);
}
}
内容来源于网络,如有侵权,请联系作者删除!