changeset 12479:e5c910daa1a4

8130507: closed/java/awt/font/JNICheck/JNICheck.sh test reports some warnings Reviewed-by: azvegint, prr
author psadhukhan
date Wed, 29 Jul 2015 20:32:35 +0300
parents 439df5e0911c
children 76098e7ea2d5
files src/java.desktop/unix/native/common/awt/awt.h src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c src/java.desktop/unix/native/libawt_xawt/awt/awt_util.c src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c
diffstat 5 files changed, 38 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/unix/native/common/awt/awt.h	Wed Jul 29 11:33:02 2015 +0400
+++ b/src/java.desktop/unix/native/common/awt/awt.h	Wed Jul 29 20:32:35 2015 +0300
@@ -82,7 +82,12 @@
     } while (0)
 
 #define AWT_LOCK_IMPL() \
-    (*env)->CallStaticVoidMethod(env, tkClass, awtLockMID)
+    do { \
+        (*env)->CallStaticVoidMethod(env, tkClass, awtLockMID); \
+        if ((*env)->ExceptionCheck(env)) { \
+            (*env)->ExceptionClear(env); \
+        } \
+    } while(0)
 
 #define AWT_NOFLUSH_UNLOCK_IMPL() \
     do { \
@@ -91,11 +96,10 @@
          (*env)->ExceptionClear(env); \
       } \
       (*env)->CallStaticVoidMethod(env, tkClass, awtUnlockMID); \
+      if ((*env)->ExceptionCheck(env)) { \
+         (*env)->ExceptionClear(env); \
+      } \
       if (pendingException) { \
-         if ((*env)->ExceptionCheck(env)) { \
-            (*env)->ExceptionDescribe(env); \
-            (*env)->ExceptionClear(env); \
-         } \
          (*env)->Throw(env, pendingException); \
       } \
     } while (0)
--- a/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c	Wed Jul 29 11:33:02 2015 +0400
+++ b/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c	Wed Jul 29 20:32:35 2015 +0300
@@ -71,6 +71,10 @@
         }
         isHeadless = (*env)->CallStaticBooleanMethod(env, graphicsEnvClass,
                                                      headlessFn);
+        if ((*env)->ExceptionCheck(env)) {
+            (*env)->ExceptionClear(env);
+            return JNI_TRUE;
+        }
     }
     return isHeadless;
 }
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Wed Jul 29 11:33:02 2015 +0400
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Wed Jul 29 20:32:35 2015 +0300
@@ -1564,6 +1564,9 @@
     for (i = 0; i < visScreenInfo->count; i++) {
         XdbeVisualInfo* visInfo = visScreenInfo->visinfo;
         (*env)->CallVoidMethod(env, this, midAddVisual, (visInfo[i]).visual);
+        if ((*env)->ExceptionCheck(env)) {
+            break;
+        }
     }
 #endif /* !HEADLESS */
 }
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_util.c	Wed Jul 29 11:33:02 2015 +0400
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_util.c	Wed Jul 29 20:32:35 2015 +0300
@@ -98,5 +98,8 @@
 
     (*env)->CallStaticVoidMethod(env, threadClass, yieldMethodID);
     DASSERT(!((*env)->ExceptionOccurred(env)));
+    if ((*env)->ExceptionCheck(env)) {
+        return JNI_FALSE;
+    }
     return JNI_TRUE;
 } /* awtJNI_ThreadYield() */
--- a/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c	Wed Jul 29 11:33:02 2015 +0400
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c	Wed Jul 29 20:32:35 2015 +0300
@@ -905,6 +905,10 @@
 
         // Init the thread system to use GLib in a thread-safe mode
         (*env)->CallStaticVoidMethod(env, clazz, mid_lock);
+        if ((*env)->ExceptionCheck(env)) {
+            AWT_UNLOCK();
+            return FALSE;
+        }
 
         // Calling g_thread_init() multiple times leads to crash on GLib < 2.24
         // We can use g_thread_get_initialized () but it is available only for
@@ -923,7 +927,22 @@
             //called before gtk_init() or gtk_init_check()
             fp_gdk_threads_init();
         }
+        jthrowable pendExcpn = NULL;
+        // Exception raised during mid_getAndSetInitializationNeededFlag
+        // call is saved and error handling is done
+        // after unlock method is called
+        if ((pendExcpn = (*env)->ExceptionOccurred(env)) != NULL) {
+            (*env)->ExceptionClear(env);
+        }
         (*env)->CallStaticVoidMethod(env, clazz, mid_unlock);
+        if (pendExcpn != NULL) {
+            (*env)->Throw(env, pendExcpn);
+        }
+        // check if any exception occured during mid_unlock call
+        if ((*env)->ExceptionCheck(env)) {
+            AWT_UNLOCK();
+            return FALSE;
+        }
     }
     result = (*fp_gtk_init_check)(NULL, NULL);