Patch: FYI: class loader fix

Tom Tromey tromey@redhat.com
Sun Nov 3 22:15:00 GMT 2002


I'm checking this in.
This fixes a class loader bug Anthony found tonight.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* java/lang/ClassLoader.java (loadClass): Call loadClass on
	VMClassLoader, not findClass.

Index: java/lang/ClassLoader.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/ClassLoader.java,v
retrieving revision 1.19
diff -u -r1.19 ClassLoader.java
--- java/lang/ClassLoader.java 19 Sep 2002 17:44:49 -0000 1.19
+++ java/lang/ClassLoader.java 4 Nov 2002 01:35:03 -0000
@@ -177,14 +177,18 @@
 
     if (c == null)
       {
-	try {
-	  if (parent != null)
-	    return parent.loadClass (name, link);
-	  else
-	    c = gnu.gcj.runtime.VMClassLoader.instance.findClass (name);
-	} catch (ClassNotFoundException ex) {
-	  /* ignore, we'll try findClass */;
-	}
+	try
+	  {
+	    ClassLoader cl = parent;
+	    if (parent == null)
+	      cl = gnu.gcj.runtime.VMClassLoader.instance;
+	    if (cl != this)
+	      c = cl.loadClass (name, link);
+	  }
+	catch (ClassNotFoundException ex)
+	  {
+	    /* ignore, we'll try findClass */;
+	  }
       }
 
     if (c == null)



More information about the Java-patches mailing list