8049057: JNI exception pending in jdk/src/windows/native/sun/windows/
authorserb
Sat, 26 Jul 2014 03:18:05 +0400
changeset 26006 da0572ecab20
parent 26005 25124e230434
child 26007 dba8f49653ce
8049057: JNI exception pending in jdk/src/windows/native/sun/windows/ Reviewed-by: pchelko, prr
jdk/src/windows/native/sun/windows/awt_Component.cpp
jdk/src/windows/native/sun/windows/awt_Cursor.cpp
jdk/src/windows/native/sun/windows/awt_PrintJob.cpp
--- a/jdk/src/windows/native/sun/windows/awt_Component.cpp	Thu Jul 24 16:06:49 2014 +0100
+++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp	Sat Jul 26 03:18:05 2014 +0400
@@ -467,7 +467,9 @@
         jclass win32GCCls = env->FindClass("sun/awt/Win32GraphicsConfig");
         DASSERT(win32GCCls != NULL);
         DASSERT(env->IsInstanceOf(compGC, win32GCCls));
-        CHECK_NULL(win32GCCls);
+        if (win32GCCls == NULL) {
+            throw std::bad_alloc();
+        }
         env->SetObjectField(peer, AwtComponent::peerGCID, compGC);
     }
 }
--- a/jdk/src/windows/native/sun/windows/awt_Cursor.cpp	Thu Jul 24 16:06:49 2014 +0100
+++ b/jdk/src/windows/native/sun/windows/awt_Cursor.cpp	Sat Jul 26 03:18:05 2014 +0400
@@ -229,9 +229,10 @@
                 if (cur != NULL) {
                     ::SetCursor(cur);
                 } else {
-                    safe_ExceptionOccurred(env);
+                    if (safe_ExceptionOccurred(env)) {
+                        env->ExceptionClear();
+                    }
                 }
-
                 if (AwtCursor::updateCursorID == NULL) {
                     jclass cls =
                     env->FindClass("sun/awt/windows/WGlobalCursorManager");
--- a/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp	Thu Jul 24 16:06:49 2014 +0100
+++ b/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp	Sat Jul 26 03:18:05 2014 +0400
@@ -758,6 +758,7 @@
   // through print dialog or start of printing
   // None of those may have happened yet, so call initPrinter()
   initPrinter(env, self);
+  JNU_CHECK_EXCEPTION(env);
   HANDLE hDevNames = AwtPrintControl::getPrintHDName(env, self);
   HDC hdc = AwtPrintControl::getPrintDC(env, self);
 
@@ -1102,6 +1103,7 @@
     jboolean err;
 
     initPrinter(env, self);
+    JNU_CHECK_EXCEPTION(env);
 
     // check for collation
     HGLOBAL hDevNames = AwtPrintControl::getPrintHDName(env, self);
@@ -1362,6 +1364,13 @@
     }
 
     initPrinter(env, self);
+    if (env->ExceptionCheck()) {
+        if (dest != NULL) {
+            JNU_ReleaseStringPlatformChars(env, dest, destination);
+        }
+        return JNI_FALSE;
+    }
+
     HDC printDC = AwtPrintControl::getPrintDC(env, self);
 
     SAVE_CONTROLWORD
@@ -3814,6 +3823,7 @@
     // pixels per inch in y direction
     jint yRes = GetDeviceCaps(printDC, LOGPIXELSY);
     err = setIntField(env, self, YRES_STR, yRes);
+    if (err) return;
 
     // x coord of printable area in pixels
     jint xOrg = GetDeviceCaps(printDC, PHYSICALOFFSETX);