當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。