8064698: [parfait] JNI exception pending in jdk/src/java/desktop/unix/native: libawt_xawt/awt/, common/awt
authorazvegint
Tue, 02 Dec 2014 12:47:12 +0300
changeset 28080 4baf6faff689
parent 28079 a0965f7bbb05
child 28081 b20407c53c23
8064698: [parfait] JNI exception pending in jdk/src/java/desktop/unix/native: libawt_xawt/awt/, common/awt Reviewed-by: alexsch, serb
jdk/src/java.desktop/unix/native/common/awt/awt_Font.c
jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.c
jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c
jdk/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c
--- a/jdk/src/java.desktop/unix/native/common/awt/awt_Font.c	Tue Dec 02 12:45:40 2014 +0300
+++ b/jdk/src/java.desktop/unix/native/common/awt/awt_Font.c	Tue Dec 02 12:47:12 2014 +0300
@@ -587,6 +587,7 @@
         Disposer_AddRecord(env, font, pDataDisposeMethod, ptr_to_jlong(fdata));
         return fdata;
     } else {
+        JNU_CHECK_EXCEPTION_RETURN(env, NULL);
         Display *display = NULL;
         struct FontData *fdata = NULL;
         char fontSpec[1024];
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.c	Tue Dec 02 12:45:40 2014 +0300
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.c	Tue Dec 02 12:47:12 2014 +0300
@@ -42,7 +42,7 @@
 JNIEXPORT void JNICALL
 Java_java_awt_Event_initIDs(JNIEnv *env, jclass cls)
 {
-    eventIDs.data = (*env)->GetFieldID(env, cls, "data", "J");
-    eventIDs.consumed = (*env)->GetFieldID(env, cls, "consumed", "Z");
-    eventIDs.id = (*env)->GetFieldID(env, cls, "id", "I");
+    CHECK_NULL(eventIDs.data = (*env)->GetFieldID(env, cls, "data", "J"));
+    CHECK_NULL(eventIDs.consumed = (*env)->GetFieldID(env, cls, "consumed", "Z"));
+    CHECK_NULL(eventIDs.id = (*env)->GetFieldID(env, cls, "id", "I"));
 }
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Tue Dec 02 12:45:40 2014 +0300
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Tue Dec 02 12:47:12 2014 +0300
@@ -23,6 +23,7 @@
  * questions.
  */
 
+#include "jni_util.h"
 #include "awt_p.h"
 #include "awt.h"
 #include "color.h"
@@ -763,6 +764,7 @@
     XSetIOErrorHandler(xioerror_handler);
     JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XErrorHandlerUtil", "init", "(J)V",
         ptr_to_jlong(awt_display));
+    JNU_CHECK_EXCEPTION_RETURN(env, NULL);
 
     /* set awt_numScreens, and whether or not we're using Xinerama */
     xineramaInit();
@@ -789,6 +791,7 @@
             x11Screens[i].root = RootWindow(awt_display, i);
         }
         x11Screens[i].defaultConfig = makeDefaultConfig(env, i);
+        JNU_CHECK_EXCEPTION_RETURN(env, NULL);
     }
 
     return dpy;
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c	Tue Dec 02 12:45:40 2014 +0300
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c	Tue Dec 02 12:47:12 2014 +0300
@@ -72,6 +72,11 @@
 
 static void quit(JNIEnv * env, jobject jpeer, gboolean isSignalHandler)
 {
+    jthrowable pendingException;
+    if (pendingException = (*env)->ExceptionOccurred(env)) {
+         (*env)->ExceptionClear(env);
+    }
+
     GtkWidget * dialog = (GtkWidget*)jlong_to_ptr(
             (*env)->GetLongField(env, jpeer, widgetFieldID));
 
@@ -95,6 +100,10 @@
             fp_gdk_threads_leave();
         }
     }
+
+    if (pendingException) {
+         (*env)->Throw(env, pendingException);
+    }
 }
 
 /*