Patch: JNI -vs- class loader

Tom Tromey tromey@cygnus.com
Wed Apr 19 22:30:00 GMT 2000


I'm checking in this patch.
It fixes JNI to use the system class loader if the current class does
not have a loader.

2000-04-19  Tom Tromey  <tromey@cygnus.com>

	* jni.cc (_Jv_JNI_FindClass): Use system class loader if class
	doesn't have a loader.

Tom

Index: jni.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/jni.cc,v
retrieving revision 1.29
diff -u -r1.29 jni.cc
--- jni.cc	2000/04/02 15:34:17	1.29
+++ jni.cc	2000/04/20 05:30:18
@@ -424,15 +424,16 @@
       // This might throw an out of memory exception.
       jstring n = JvNewStringUTF (s);
 
-      java::lang::ClassLoader *loader;
-      if (env->klass == NULL)
+      java::lang::ClassLoader *loader = NULL;
+      if (env->klass != NULL)
+	loader = env->klass->getClassLoader ();
+
+      if (loader == NULL)
 	{
 	  // FIXME: should use getBaseClassLoader, but we don't have that
 	  // yet.
 	  loader = java::lang::ClassLoader::getSystemClassLoader ();
 	}
-      else
-	loader = env->klass->getClassLoader ();
 
       r = loader->loadClass (n);
     }


More information about the Java-patches mailing list