# HG changeset patch # User psadhukhan # Date 1438191155 -10800 # Node ID 92824eb030c52ecf1fb81c44a6d9a2cd5859c69f # Parent 07341d3eb87d5561a368c00334d5b0f7ee859fb5 8130507: closed/java/awt/font/JNICheck/JNICheck.sh test reports some warnings Reviewed-by: azvegint, prr diff -r 07341d3eb87d -r 92824eb030c5 jdk/src/java.desktop/unix/native/common/awt/awt.h --- a/jdk/src/java.desktop/unix/native/common/awt/awt.h Wed Jul 29 11:33:02 2015 +0400 +++ b/jdk/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) diff -r 07341d3eb87d -r 92824eb030c5 jdk/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c --- a/jdk/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c Wed Jul 29 11:33:02 2015 +0400 +++ b/jdk/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; } diff -r 07341d3eb87d -r 92824eb030c5 jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c --- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c Wed Jul 29 11:33:02 2015 +0400 +++ b/jdk/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 */ } diff -r 07341d3eb87d -r 92824eb030c5 jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_util.c --- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_util.c Wed Jul 29 11:33:02 2015 +0400 +++ b/jdk/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() */ diff -r 07341d3eb87d -r 92824eb030c5 jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c --- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c Wed Jul 29 11:33:02 2015 +0400 +++ b/jdk/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);