当前位置: 首页>>代码示例>>Java>>正文


Java MalformedURLException.getMessage方法代码示例

本文整理汇总了Java中java.net.MalformedURLException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java MalformedURLException.getMessage方法的具体用法?Java MalformedURLException.getMessage怎么用?Java MalformedURLException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.net.MalformedURLException的用法示例。


在下文中一共展示了MalformedURLException.getMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: unmarshal

import java.net.MalformedURLException; //导入方法依赖的package包/类
public final Object unmarshal( File f ) throws JAXBException {
    if( f == null ) {
        throw new IllegalArgumentException(
            Messages.format( Messages.MUST_NOT_BE_NULL, "file" ) );
    }

    try {
        // copied from JAXP
        String path = f.getAbsolutePath();
        if (File.separatorChar != '/')
            path = path.replace(File.separatorChar, '/');
        if (!path.startsWith("/"))
            path = "/" + path;
        if (!path.endsWith("/") && f.isDirectory())
            path = path + "/";
        return unmarshal(new URL("file", "", path));
    } catch( MalformedURLException e ) {
        throw new IllegalArgumentException(e.getMessage());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:AbstractUnmarshallerImpl.java

示例2: stringToUrl

import java.net.MalformedURLException; //导入方法依赖的package包/类
/**
 * This method transform a given URL in {@link String} format into a {@link URL} object.
 * @param string {@link String}
 * @return {@link URL}
 * @throws JSKException If 'string' param is null.
 * @throws JSKException If 'string' param contains a malformed URL.
 */
public static URL stringToUrl(String string) throws JSKException {
	
	if(isNull(string)) {
		throw new JSKException(NULL_PARAMETERS);
	}
	
	if(voidOrNull(string)) {
		throw new JSKException(EMPTY_PARAMETERS);
	}
	
	try {
		return new URL(string);
	}
	catch(MalformedURLException exception) {
		throw new JSKException(exception.getMessage());
	}
}
 
开发者ID:Varoso,项目名称:JSK,代码行数:25,代码来源:JSKUrl.java

示例3: urlToContext

import java.net.MalformedURLException; //导入方法依赖的package包/类
private static Context urlToContext(String url, Hashtable<?,?> env)
        throws NamingException {

    DnsUrl[] urls;
    try {
        urls = DnsUrl.fromList(url);
    } catch (MalformedURLException e) {
        throw new ConfigurationException(e.getMessage());
    }
    if (urls.length == 0) {
        throw new ConfigurationException(
                "Invalid DNS pseudo-URL(s): " + url);
    }
    String domain = urls[0].getDomain();

    // If multiple urls, all must have the same domain.
    for (int i = 1; i < urls.length; i++) {
        if (!domain.equalsIgnoreCase(urls[i].getDomain())) {
            throw new ConfigurationException(
                    "Conflicting domains: " + url);
        }
    }
    return getContext(domain, urls, env);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:DnsContextFactory.java

示例4: buildUrl

import java.net.MalformedURLException; //导入方法依赖的package包/类
private static URL buildUrl(String urlSpec,
                            URLStreamHandler handler) {
    try {
        URLStreamHandler keyHandler;
        if (handler == null && urlSpec.startsWith(LEP_PROTOCOL + ":")) {
            keyHandler = buildDefaultStreamHandler();
        } else {
            keyHandler = handler;
        }

        return new URL(null, urlSpec, keyHandler);
    } catch (MalformedURLException e) {
        throw new IllegalArgumentException("Can't build URL by LEP resource spec: "
                                               + urlSpec
                                               + " because of error: "
                                               + e.getMessage(), e);
    }
}
 
开发者ID:xm-online,项目名称:xm-lep,代码行数:19,代码来源:UrlLepResourceKey.java

示例5: initUsingCorbanameUrl

import java.net.MalformedURLException; //导入方法依赖的package包/类
/**
 * Initializes using "corbaname" URL (INS 99-12-03)
 */
private String initUsingCorbanameUrl(ORB orb, String url, Hashtable<?,?> env)
    throws NamingException {

    if (orb == null)
            orb = getDefaultOrb();

    try {
        CorbanameUrl parsedUrl = new CorbanameUrl(url);

        String corbaloc = parsedUrl.getLocation();
        String cosName = parsedUrl.getStringName();

        setOrbAndRootContext(orb, corbaloc);

        return parsedUrl.getStringName();
    } catch (MalformedURLException e) {
        throw new ConfigurationException(e.getMessage());
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:CNCtx.java

示例6: getRepository

import java.net.MalformedURLException; //导入方法依赖的package包/类
@Override
/**
 * Instantiate and return repository object.
 *
 */
public Repository getRepository(RepositoryImplConfig config) throws RepositoryConfigException {
    MarkLogicRepository repo = null;
    MarkLogicRepositoryConfig cfg = (MarkLogicRepositoryConfig) config;
    if (cfg.getHost() != null && cfg.getPort() != 0) {
        // init with MarkLogicRepositoryConfig
        repo = new MarkLogicRepository(cfg.getHost(),cfg.getPort(),cfg.getUser(),cfg.getPassword(),cfg.getAuth());
    } else if (cfg.getHost() == null) {
        // init with queryEndpoint as connection string
        try {
            repo = new MarkLogicRepository(new URL(cfg.getQueryEndpointUrl()));
        } catch (MalformedURLException e) {
            logger.debug(e.getMessage());
            throw new RepositoryConfigException(e.getMessage());
        }
    }else{
        throw new RepositoryConfigException("Invalid configuration class: " + config.getClass());
    }
    return repo;
}
 
开发者ID:marklogic,项目名称:marklogic-rdf4j,代码行数:25,代码来源:MarkLogicRepositoryFactory.java

示例7: safeURL

import java.net.MalformedURLException; //导入方法依赖的package包/类
private static URL safeURL(String urlString) throws ClassNotFoundException {
	try {
		return new URL(urlString);
	} catch (MalformedURLException exception) {
		throw new ClassNotFoundException(exception.getMessage());
	}
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:8,代码来源:Beans.java

示例8: getURI

import java.net.MalformedURLException; //导入方法依赖的package包/类
public String getURI(){
    try{
        String uri = file.toURL().toString();
        if (ref != null && !"".equals(ref)){
            uri += '#' + ref;
        }
        return uri;
    } catch(MalformedURLException e){
        throw new Error( e.getMessage() );
    }
}
 
开发者ID:etomica,项目名称:etomica,代码行数:12,代码来源:SVGConverterFileSource.java

示例9: toJavaURL

import java.net.MalformedURLException; //导入方法依赖的package包/类
public java.net.URL toJavaURL() {
    try {
        return new java.net.URL(toString());
    } catch (MalformedURLException e) {
        throw new IllegalStateException(e.getMessage(), e);
    }
}
 
开发者ID:tiglabs,项目名称:jsf-core,代码行数:8,代码来源:URL.java

示例10: getJettyURL

import java.net.MalformedURLException; //导入方法依赖的package包/类
private static URL getJettyURL(Server server) {
  boolean ssl = server.getConnectors()[0].getClass()
      == SslSocketConnectorSecure.class;
  try {
    String scheme = (ssl) ? "https" : "http";
    return new URL(scheme + "://" +
        server.getConnectors()[0].getHost() + ":" +
        server.getConnectors()[0].getLocalPort());
  } catch (MalformedURLException ex) {
    throw new RuntimeException("It should never happen, " + ex.getMessage(),
        ex);
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:14,代码来源:MiniKMS.java

示例11: parseUrl

import java.net.MalformedURLException; //导入方法依赖的package包/类
private static URL parseUrl(ConfigurationSection section, String path, @Nullable String value, URL def) {
    try {
        return value == null ? def : new URL(value);
    } catch(MalformedURLException e) {
        throw new InvalidConfigurationException(section, path, e.getMessage());
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:8,代码来源:ConfigUtils.java

示例12: validateInput

import java.net.MalformedURLException; //导入方法依赖的package包/类
private void validateInput(Input input) {
	if(input.getText() == null && input.getUrl() == null) {
		throw new IllegalArgumentException("You should provide a text or an URL input");
	}
	if (input.getText() == null && input.getUrl() != null) {
		try {
			new URL(input.getUrl());
		} catch (MalformedURLException e) {
			throw new IllegalArgumentException("URL is not valid: " + e.getMessage());
		}
	}
	if(input.getUrl() == null && input.getText().trim().isEmpty()) {
		throw new IllegalArgumentException("Text can't be an empty String.");
	}
}
 
开发者ID:jesuino,项目名称:kie-ml,代码行数:16,代码来源:KieMLServiceImpl.java

示例13: getJettyURL

import java.net.MalformedURLException; //导入方法依赖的package包/类
/**
 * Returns the base URL (SCHEMA://HOST:PORT) of the test Jetty server
 * (see {@link #getJettyServer()}) once started.
 *
 * @return the base URL (SCHEMA://HOST:PORT) of the test Jetty server.
 */
public static URL getJettyURL() {
  TestJettyHelper helper = TEST_JETTY_TL.get();
  if (helper == null || helper.server == null) {
    throw new IllegalStateException("This test does not use @TestJetty");
  }
  try {
    String scheme = (helper.ssl) ? "https" : "http";
    return new URL(scheme + "://" +
        helper.server.getConnectors()[0].getHost() + ":" +
        helper.server.getConnectors()[0].getPort());
  } catch (MalformedURLException ex) {
    throw new RuntimeException("It should never happen, " + ex.getMessage(), ex);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestJettyHelper.java

示例14: toURL

import java.net.MalformedURLException; //导入方法依赖的package包/类
private URL toURL(String url) {
    try {
        return new URL(url);
    } catch (MalformedURLException malformedURLEx) {
        throw new DingtalkNotificationPluginException("Dingtalk API URL is malformed: [" + malformedURLEx.getMessage() + "].", malformedURLEx);
    }
}
 
开发者ID:nongfenqi,项目名称:dingtalk-incoming-webhoot-plugin,代码行数:8,代码来源:DingtalkNotificationPlugin.java

示例15: setUrl

import java.net.MalformedURLException; //导入方法依赖的package包/类
public void setUrl(String wikiUrl) {
    try {
        iWikiUrl = new URL(wikiUrl);
    } catch (MalformedURLException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:8,代码来源:WikiGet.java


注:本文中的java.net.MalformedURLException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。