This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: JNI bug fix
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 10 Nov 2002 00:53:25 -0700
- Subject: Patch: FYI: JNI bug fix
- Reply-to: tromey at redhat dot com
I'm checking this in.
When starting a call to a user's JNI method, we must clear the
exception state. Previously we failed to do this, resulting in
incorrect behavior.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* jni.cc (_Jv_GetJNIEnvNewFrame): Set env->ex in all cases.
Index: jni.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni.cc,v
retrieving revision 1.65
diff -u -r1.65 jni.cc
--- jni.cc 6 Nov 2002 14:14:51 -0000 1.65
+++ jni.cc 10 Nov 2002 07:51:54 -0000
@@ -1984,9 +1984,9 @@
{
env = (JNIEnv *) _Jv_MallocUnchecked (sizeof (JNIEnv));
env->p = &_Jv_JNIFunctions;
- env->ex = NULL;
env->klass = klass;
env->locals = NULL;
+ // We set env->ex below.
_Jv_SetCurrentJNIEnv (env);
}
@@ -1999,10 +1999,12 @@
frame->marker = MARK_SYSTEM;
frame->size = FRAME_SIZE;
frame->next = env->locals;
- env->locals = frame;
for (int i = 0; i < frame->size; ++i)
frame->vec[i] = NULL;
+
+ env->locals = frame;
+ env->ex = NULL;
return env;
}