This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

java.util.ResourceBundle bug?


Unless I'm mistaken, the stopgap implementation of
java.util.ResourceBundle.getClassContext() in natResourceBundle.cc is
broken.  The .java file claims it returns an array of Class, but it seems to
actually return an array of ClassLoader.  I suspect the resulting code can
generate out of bounds memory accesses.  (The existing code seemed to work
when linking dynamically on Itanium, but broke when linking statically.  My
guess is that in the dynamic case, there happened to be a zero in the right
place, but this was pure luck.)

The following "fix" seems to improve matters, but I have very little
confidence that it's the right thing to do.  If it is I can check it in.  If
not, I'm open to suggestions ...

Hans

Index: natResourceBundle.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/natResourceBundle.cc,v
retrieving revision 1.1
diff -u -r1.1 natResourceBundle.cc
--- natResourceBundle.cc	2001/08/31 21:31:20	1.1
+++ natResourceBundle.cc	2001/11/02 20:11:05
@@ -24,7 +24,7 @@
   // only have the system class loader.
   jobjectArray a = JvNewObjectArray (2, &java::lang::Class::class$, NULL);
   jobject *elts = elements (a);
-  elts[0] = java::lang::ClassLoader::getSystemClassLoader ();
+  elts[0] = &java::lang::Object::class$;
   elts[1] = elts[0];
 
   return reinterpret_cast< JArray<jclass> *> (a);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]