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