This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: resource bundle fix
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 19 Dec 2002 19:01:42 -0700
- Subject: Patch: FYI: resource bundle fix
- Reply-to: tromey at redhat dot com
I'm checking this in to the trunk and the 3.3 branch.
Andrew wrote this last week but it didn't go in. This fixes the
problem with backtrace-less systems that Ulrich pointed out today.
Tom
* java/util/natResourceBundle.cc: Include
ArrayIndexOutOfBoundsException.h.
(getCallingClassLoader): Don't put upper bound on stack search.
Catch ArrayIndexOutOfBoundsException.
Index: java/util/natResourceBundle.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/natResourceBundle.cc,v
retrieving revision 1.5
diff -u -r1.5 natResourceBundle.cc
--- java/util/natResourceBundle.cc 10 Dec 2002 01:29:29 -0000 1.5
+++ java/util/natResourceBundle.cc 20 Dec 2002 01:58:10 -0000
@@ -16,17 +16,24 @@
#include <java/lang/SecurityManager.h>
#include <java/lang/ClassLoader.h>
#include <java/lang/Class.h>
+#include <java/lang/ArrayIndexOutOfBoundsException.h>
#include <gnu/gcj/runtime/StackTrace.h>
java::lang::ClassLoader *
java::util::ResourceBundle::getCallingClassLoader ()
{
gnu::gcj::runtime::StackTrace *t = new gnu::gcj::runtime::StackTrace(6);
- for (int i = 3; i < 6; ++i)
+ try
+ {
+ for (int i = 3; ; ++i)
+ {
+ jclass klass = t->classAt(i);
+ if (klass != NULL)
+ return klass->getClassLoaderInternal();
+ }
+ }
+ catch (::java::lang::ArrayIndexOutOfBoundsException *e)
{
- jclass klass = t->classAt(i);
- if (klass != NULL)
- return klass->getClassLoaderInternal();
}
return NULL;
}