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

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
This commit is contained in:
Andrew Haley 2003-01-14 19:26:21 +00:00 committed by Andrew Haley
parent d9bbf3f743
commit 4cf0d20fce
2 changed files with 21 additions and 8 deletions

View 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