本文整理了Java中java.net.MalformedURLException.toString()
方法的一些代码示例,展示了MalformedURLException.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MalformedURLException.toString()
方法的具体详情如下:
包路径:java.net.MalformedURLException
类名称:MalformedURLException
方法名:toString
暂无
代码示例来源:origin: knightliao/disconf
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());
}
}
}
代码示例来源:origin: zalando/zalenium
@Override
public URL getRemoteHost() {
try {
return new URL(getCloudTestingServiceUrl());
} catch (MalformedURLException e) {
logger.error(e.toString(), e);
getGa().trackException(e);
}
return null;
}
代码示例来源:origin: twosigma/beakerx
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));
}
代码示例来源:origin: robovm/robovm
throw new NullPointerException(e.toString());
代码示例来源:origin: spring-projects/spring-loaded
/**
* 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;
}
代码示例来源:origin: aragozin/jvm-tools
commandHost.fail("JMX Connection failed: " + e.toString(), e);
} catch (IOException e) {
commandHost.fail("JMX Connection failed: " + e.toString(), e);
代码示例来源:origin: org.apache.ant/ant
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;
}
代码示例来源:origin: geotools/geotools
gazetteerURL = new URL(gazetteer.toString() + "&placename=" + place);
} catch (MalformedURLException e) {
results.error(feature, e.toString());
代码示例来源:origin: aliyun/aliyun-oss-java-sdk
@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());
}
}
代码示例来源:origin: aliyun/aliyun-oss-java-sdk
@Override
public URL buildUrl() throws ClientException {
try {
return new URL(ossAuthServerHost);
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e.toString());
}
}
代码示例来源:origin: com.aliyun.oss/aliyun-sdk-oss
@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());
}
}
代码示例来源:origin: com.aliyun.openservices/tablestore
@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());
}
}
代码示例来源:origin: com.aliyun/aliyun-java-sdk-core
private void setCredentialUrl() {
try {
this.credentialUrl = new URL("http://" + metadataServiceHost + URL_IN_ECS_METADATA + roleName);
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e.toString());
}
}
代码示例来源:origin: com.aliyun.oss/aliyun-sdk-oss
@Override
public URL buildUrl() throws ClientException {
try {
return new URL(ossAuthServerHost);
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e.toString());
}
}
代码示例来源:origin: org.sonatype.sisu.inject/guice-bean-converters
public Object convert( final String value, final TypeLiteral<?> toType )
{
try
{
return new URL( value );
}
catch ( final MalformedURLException e )
{
throw new ProvisionException( e.toString() );
}
}
}
代码示例来源:origin: wala/WALA
@Override
public URL getURL() {
try {
return new URL("file:" + path);
} catch (MalformedURLException e) {
Assertions.UNREACHABLE(e.toString());
return null;
}
}
代码示例来源:origin: com.atlassian.org.eclipse.sisu/org.eclipse.sisu.inject
public Object convert( final String value, final TypeLiteral<?> toType )
{
try
{
return new URL( value );
}
catch ( final MalformedURLException e )
{
throw new ProvisionException( e.toString() );
}
}
}
代码示例来源:origin: apache/cxf
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;
}
}
代码示例来源:origin: httpunit/httpunit
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();
}
}
}
代码示例来源:origin: httpunit/httpunit
public String getHref() {
try {
return new URL( ((HTMLDocumentImpl) getOwnerDocument()).getWindow().getUrl(), getAttributeWithNoDefault( "href" ) ).toExternalForm();
} catch (MalformedURLException e) {
return e.toString();
}
}
内容来源于网络,如有侵权,请联系作者删除!