This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
Patch: JNI -vs- class loader
- To: Java Patch List <java-patches at sourceware dot cygnus dot com>
- Subject: Patch: JNI -vs- class loader
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 19 Apr 2000 23:33:11 -0600
- Reply-To: tromey at cygnus dot com
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);
}