You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mikhail Markov (JIRA)" <ji...@apache.org> on 2006/12/25 18:22:24 UTC

[jira] Updated: (HARMONY-2871) [classlib][luni] URLClassLoader invalidates it's state if there is invalid URLs in its urls list

     [ http://issues.apache.org/jira/browse/HARMONY-2871?page=all ]

Mikhail Markov updated HARMONY-2871:
------------------------------------

    Attachment: URLClassLoader.patch

Here is the patch for the class loader - it modifies the way URLClassLoader deals with invalid urls: it does not set the invalid urls to null in the internal list but put them into internal "excluded" list instead.

> [classlib][luni] URLClassLoader invalidates it's state if there is invalid URLs in its urls list
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2871
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2871
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: WinXP
>            Reporter: Mikhail Markov
>            Priority: Critical
>         Attachments: URLClassLoader.patch
>
>
> The test below passed on RI, but fails on Harmony.
> Output on Harmony:
> FAILED: java.lang.NullPointerException
> Output on RI:
> PASSED.
> The cause is that URLClassLoader sets URL's in it's internal list which it could not open to null and throws NPE during the next attempt to load the class.
> -------------------- Test.java ------------------------
> import java.net.URL;
> import java.net.URLClassLoader;
> public class Test {
>     public static void main(String [] args) throws Exception {
>         URLClassLoader cl = new URLClassLoader(new URL[] { new URL("file:/c:/foo.jar") });
>         try {
>             Class.forName("foo.Foo", false, cl);
>         } catch (Exception ex) {
>             // Don't care
>         }
>         try {
>             Class.forName("foo.Foo", false, cl);
>             System.out.println("FAILED: no exceptions");
>         } catch (ClassNotFoundException cnfe) {
>             System.out.println("PASSED.");
>         } catch (Exception ex) {
>             System.out.println("FAILED: " + ex);
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira