Patch: FYI: JNI bug fix

Tom Tromey tromey@redhat.com
Sun Nov 10 09:46:00 GMT 2002


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;
 }



More information about the Java-patches mailing list