[4.0] Patch: FYI: PR 21020

Tom Tromey tromey@redhat.com
Wed Aug 24 18:04:00 GMT 2005


I'm checking this in on the 4.0 branch.

I don't know why this patch didn't go on the branch in the first
place.  Caolan pointed out this OO.o bug which this patch addresses:

http://www.openoffice.org/issues/show_bug.cgi?id=51724

Tom

Index: ChangeLog
from  Andrew Haley  <aph@redhat.com>

	PR libgcj/21020:
	* jni.cc (_Jv_JNI_GetAnyFieldID): Use class' loader to find
	field's type.

Index: jni.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni.cc,v
retrieving revision 1.95
diff -u -r1.95 jni.cc
--- jni.cc 23 Feb 2005 17:36:23 -0000 1.95
+++ jni.cc 24 Aug 2005 18:01:58 -0000
@@ -46,6 +46,7 @@
 #include <java/nio/DirectByteBufferImpl$ReadWrite.h>
 #include <java/util/IdentityHashMap.h>
 #include <gnu/gcj/RawData.h>
+#include <java/lang/ClassNotFoundException.h>
 
 #include <gcj/method.h>
 #include <gcj/field.h>
@@ -1199,11 +1200,11 @@
       char s[len + 1];
       for (int i = 0; i <= len; ++i)
 	s[i] = (sig[i] == '/') ? '.' : sig[i];
-      jclass field_class = _Jv_FindClassFromSignature ((char *) s, NULL);
-
-      // FIXME: what if field_class == NULL?
-
       java::lang::ClassLoader *loader = clazz->getClassLoaderInternal ();
+      jclass field_class = _Jv_FindClassFromSignature ((char *) s, loader);
+      if (! field_class)
+	throw new java::lang::ClassNotFoundException(JvNewStringUTF(s));
+
       while (clazz != NULL)
 	{
 	  // We acquire the class lock so that fields aren't resolved



More information about the Java-patches mailing list