Patch: classloader fix

Tom Tromey tromey@cygnus.com
Thu Jan 13 10:13:00 GMT 2000


This patch fixes the ClassLoader buglet I found yesterday.  The bug is
that we erroneously register the system class loader, and not the
actual initiating class loader, as one of class' initiating class
loaders.  I'm checking it in.

2000-01-13  Tom Tromey  <tromey@cygnus.com>

	* java/lang/natClassLoader.cc (_Jv_FindClass): Register `loader',
	not system loader, as initiating loader.


Tom

Index: java/lang/natClassLoader.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/natClassLoader.cc,v
retrieving revision 1.12
diff -u -r1.12 natClassLoader.cc
--- natClassLoader.cc	1999/10/22 19:43:41	1.12
+++ natClassLoader.cc	2000/01/13 18:09:36
@@ -1,6 +1,6 @@
 // natClassLoader.cc - Implementation of java.lang.ClassLoader native methods.
 
-/* Copyright (C) 1999  Cygnus Solutions
+/* Copyright (C) 1999, 2000  Cygnus Solutions
 
    This file is part of libgcj.
 
@@ -437,13 +437,11 @@
 	  // Load using a user-defined loader, jvmspec 5.3.2
 	  klass = loader->loadClass(sname, false);
 
-	  // if "loader" delegateted the loadClass operation
-	  // to another loader, register explicitly
-	  // that he is also an initiating loader of the
-	  // given class.  	  
-
+	  // If "loader" delegated the loadClass operation to another
+	  // loader, explicitly register that it is also an initiating
+	  // loader of the given class.
 	  if (klass && (klass->getClassLoader () != loader))
-	    _Jv_RegisterInitiatingLoader (klass, 0);
+	    _Jv_RegisterInitiatingLoader (klass, loader);
 	}
       else 
 	{
@@ -454,7 +452,7 @@
 	      sys = java::lang::ClassLoader::getSystemClassLoader ();
 	    }
 
-	  // Load using the bootstrap loader jmspec 5.3.1.
+	  // Load using the bootstrap loader jvmspec 5.3.1.
 	  klass = sys->loadClass (sname, false); 
 
 	  // Register that we're an initiating loader.


More information about the Java-patches mailing list