diff options
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/java/lang/natRuntime.cc | 24 |
2 files changed, 21 insertions, 8 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 062a4a9..4389731 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -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. diff --git a/libjava/java/lang/natRuntime.cc b/libjava/java/lang/natRuntime.cc index f5177b0..f74a1e7 100644 --- a/libjava/java/lang/natRuntime.cc +++ b/libjava/java/lang/natRuntime.cc @@ -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 |