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


Java MalformedURLException.toString方法代码示例

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


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

示例1: addRepository

import java.net.MalformedURLException; //导入方法依赖的package包/类
/**
 * Add a new repository to the set of places this ClassLoader can look for
 * classes to be loaded.
 *
 * @param repository Name of a source of classes to be loaded, such as a
 *  directory pathname, a JAR file pathname, or a ZIP file pathname
 *
 * @exception IllegalArgumentException if the specified repository is
 *  invalid or does not exist
 */
public void addRepository(String repository) {

    if (debug >= 1)
        log("addRepository(" + repository + ")");

    // Add this repository to our underlying class loader
    try {
        URLStreamHandler streamHandler = null;
        String protocol = parseProtocol(repository);
        if (factory != null)
            streamHandler = factory.createURLStreamHandler(protocol);
        URL url = new URL(null, repository, streamHandler);
        super.addURL(url);
    } catch (MalformedURLException e) {
        throw new IllegalArgumentException(e.toString());
    }

    // Add this repository to our internal list
    addRepositoryInternal(repository);

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:32,代码来源:StandardClassLoader.java

示例2: addRepository

import java.net.MalformedURLException; //导入方法依赖的package包/类
/**
 * Add a new repository to the set of places this ClassLoader can look for
 * classes to be loaded.
 *
 * @param repository Name of a source of classes to be loaded, such as a
 *  directory pathname, a JAR file pathname, or a ZIP file pathname
 *
 * @exception IllegalArgumentException if the specified repository is
 *  invalid or does not exist
 */
public void addRepository(String repository) {

    // Ignore any of the standard repositories, as they are set up using
    // either addJar or addRepository
    if (repository.startsWith("/WEB-INF/lib")
        || repository.startsWith("/WEB-INF/classes"))
        return;

    // Add this repository to our underlying class loader
    try {
        URL url = new URL(repository);
        super.addURL(url);
        hasExternalRepositories = true;
    } catch (MalformedURLException e) {
        throw new IllegalArgumentException(e.toString());
    }

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:29,代码来源:WebappClassLoader.java

示例3: getZ

import java.net.MalformedURLException; //导入方法依赖的package包/类
public URL getZ() {
    try {
        return new URL((String)((Cell)getProperty("z")).o);
    } catch (MalformedURLException mfue) {
        throw new IllegalStateException(mfue.toString());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:SystemOptionTest.java

示例4: getHref

import java.net.MalformedURLException; //导入方法依赖的package包/类
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();
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:HTMLAnchorElementImpl.java

示例5: getHref

import java.net.MalformedURLException; //导入方法依赖的package包/类
public String getHref() {
    try {
        return new URL( ((HTMLDocumentImpl) getOwnerDocument()).getWindow().getUrl(), getAttributeWithNoDefault( "href" ) ).toExternalForm();
    } catch (MalformedURLException e) {
        return e.toString();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:HTMLAreaElementImpl.java


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