This is the mail archive of the java-patches@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]
Other format: [Raw text]

Patch: FYI: resource bundle fix


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;
 }


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