natRuntime.cc (_load): StackTrace access needs to be in a try block.
authorAndrew Haley <aph@redhat.com>
Tue, 14 Jan 2003 19:26:21 +0000 (19:26 +0000)
committerAndrew Haley <aph@gcc.gnu.org>
Tue, 14 Jan 2003 19:26:21 +0000 (19:26 +0000)
2003-01-14  Andrew Haley  <aph@redhat.com>

        * java/lang/natRuntime.cc (_load): StackTrace access needs to be
        in a try block.

From-SVN: r61293

libjava/ChangeLog
libjava/java/lang/natRuntime.cc

index 062a4a98c24055d5559c4dd5a5e028ef4e75096b..43897310dc14da0fc7d2d09a5c0188a32e8d01b8 100644 (file)
@@ -1,3 +1,8 @@
+2003-01-14  Andrew Haley  <aph@redhat.com>
+
+       * java/lang/natRuntime.cc (_load): StackTrace access needs to be
+       in a try block.
+
 2003-01-10  Andrew Haley  <aph@redhat.com>
 
        * include/dwarf2-signal.h: Remove x86_64.
index f5177b0aa3588d84d88e24692b5ff8fb72e095fb..f74a1e76bcf0c71abe0e4290258f1bb75897f901 100644 (file)
@@ -29,6 +29,7 @@ details.  */
 #include <java/lang/ConcreteProcess.h>
 #include <java/lang/ClassLoader.h>
 #include <gnu/gcj/runtime/StackTrace.h>
+#include <java/lang/ArrayIndexOutOfBoundsException.h>
 
 #include <jni.h>
 
@@ -181,19 +182,26 @@ java::lang::Runtime::_load (jstring path, jboolean do_search)
       ClassLoader *sys = ClassLoader::getSystemClassLoader();
       ClassLoader *look = NULL;
       gnu::gcj::runtime::StackTrace *t = new gnu::gcj::runtime::StackTrace(10);
-      for (int i = 0; i < 10; ++i)
-       {
-         jclass klass = t->classAt(i);
-         if (klass != NULL)
+      try
+       {
+         for (int i = 0; i < 10; ++i)
            {
-             ClassLoader *loader = klass->getClassLoaderInternal();
-             if (loader != NULL && loader != sys)
+             jclass klass = t->classAt(i);
+             if (klass != NULL)
                {
-                 look = loader;
-                 break;
+                 ClassLoader *loader = klass->getClassLoaderInternal();
+                 if (loader != NULL && loader != sys)
+                   {
+                     look = loader;
+                     break;
+                   }
                }
            }
        }
+      catch (::java::lang::ArrayIndexOutOfBoundsException *e)
+       {
+       }
+
       if (look != NULL)
        {
          // Don't include solib prefix in string passed to