Hi,
More bugs exposed by mixing with OpenJDK code.
We need to add the factory to the factory cache before calling addURLs, because
addURLs will end up querying the cache and the will throw a NPE if the factory
isn't there.
Calling initCause() on a ClassNotFoundException is not allowed on OpenJDK.
Regards,
Jeroen
2007-06-21 Jeroen Frijters <[EMAIL PROTECTED]>
* java/net/URLClassLoader.java
(URLClassLoader(URL[],ClassLoader,URLStreamHandlerFactory):
Add factory to cache before calling addURLS.
(run): Don't call initCause() on ClassNotFoundException.
Index: java/net/URLClassLoader.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/URLClassLoader.java,v
retrieving revision 1.53
diff -u -r1.53 URLClassLoader.java
--- java/net/URLClassLoader.java 18 Dec 2006 21:37:39 -0000 1.53
+++ java/net/URLClassLoader.java 18 Jun 2007 16:03:36 -0000
@@ -262,10 +262,9 @@
super(parent);
this.securityContext = null;
this.factory = factory;
- addURLs(urls);
-
- // If this factory is still not in factoryCache, add it.
+ // If this factory is not yet in factoryCache, add it.
factoryCache.add(factory);
+ addURLs(urls);
}
// Methods
@@ -624,10 +623,7 @@
}
catch (IOException ioe)
{
- ClassNotFoundException cnfe;
- cnfe = new ClassNotFoundException(className + " not found in " + this);
- cnfe.initCause(ioe);
- throw cnfe;
+ throw new ClassNotFoundException(className + " not found in " + this,
ioe);
}
}