PR 12001 - ClassLoader fix

Nathan Bryant nbryant@optonline.net
Tue Dec 2 19:45:00 GMT 2003


Sorry if this is posted to too many lists, I'm not sure which is 
correct. This is my suggested patch for PR 12001 which I would like to 
get reviewed.

See also http://gcc.gnu.org/ml/java-patches/2003-q4/msg00012.html for a 
possibly related issue

from  Nathan Bryant  <nbryant@optonline.net>
	* java/net/URLClassLoader.java (addURLs): Now protected instead of private
	* gnu/gcj/runtime/VMClassLoader.java: (PR 12001) Delay initialization of URL
	handlers until after class construction, to avoid circular initialization.

--- /home/nbryant/gcc/gcc-3_3_1/jb_bak/java/net/URLClassLoader.java~14~	Thu Aug 21 01:57:55 2003
+++ java/net/URLClassLoader.java	Thu Aug 21 02:45:22 2003
@@ -688,7 +688,7 @@
    * Adds an array of new locations to the end of the internal URL store.
    * @param newUrls the locations to add
    */
-  private void addURLs(URL[] newUrls)
+  protected void addURLs(URL[] newUrls)
   {
     for (int i = 0; i < newUrls.length; i++)
     {
--- gnu/gcj/runtime/VMClassLoader.java.orig	Sun Dec  8 19:03:59 2002
+++ gnu/gcj/runtime/VMClassLoader.java	Thu Aug 21 11:42:27 2003
@@ -18,7 +18,7 @@
 {
   private VMClassLoader ()
   {	
-    super (init());
+    super (new URL[] {});
   }
 
   private static URL[] init() 
@@ -69,4 +69,9 @@
 
   // The only VMClassLoader that can exist.
   public static VMClassLoader instance = new VMClassLoader ();
+
+  static
+  {
+    instance.addURLs(init());
+  }
 }





More information about the Java mailing list