This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: natRuntime stack trace bug fix
Tom Tromey writes:
> >>>>> "Andrew" == Andrew Haley <aph@redhat.com> writes:
>
> Andrew> 2003-01-10 Andrew Haley <aph@.redhat.com>
> Andrew> * java/lang/natRuntime.cc (_load): StackTrace access needs to be
> Andrew> in a try block.
>
> I think this changes the semantics a bit.
>
> Andrew> ! for (int i = 1; !klass; i++)
>
> If klass!=NULL and it was loaded with the system loader, we'll still
> exit the loop.
OK.
Andrew.
* java/lang/natRuntime.cc (_load): StackTrace access needs to be
in a try block.
Index: natRuntime.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natRuntime.cc,v
retrieving revision 1.29
diff -u -w -r1.29 natRuntime.cc
--- natRuntime.cc 10 Dec 2002 01:39:32 -0000 1.29
+++ natRuntime.cc 14 Jan 2003 17:05:11 -0000
@@ -29,6 +29,7 @@
#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,6 +182,8 @@
ClassLoader *sys = ClassLoader::getSystemClassLoader();
ClassLoader *look = NULL;
gnu::gcj::runtime::StackTrace *t = new gnu::gcj::runtime::StackTrace(10);
+ try
+ {
for (int i = 0; i < 10; ++i)
{
jclass klass = t->classAt(i);
@@ -194,6 +197,11 @@
}
}
}
+ }
+ catch (::java::lang::ArrayIndexOutOfBoundsException *e)
+ {
+ }
+
if (look != NULL)
{
// Don't include solib prefix in string passed to