8054800: JNI exception pending in jdk/src/windows/native/sun/windows/awt_Win32GraphicsDevice.cpp
authorserb
Wed, 13 Aug 2014 21:45:53 +0400
changeset 26347 4d4a67fa0505
parent 26346 40ef53fafcce
child 26348 da1711644b77
8054800: JNI exception pending in jdk/src/windows/native/sun/windows/awt_Win32GraphicsDevice.cpp Reviewed-by: azvegint, prr
jdk/src/windows/native/sun/windows/awt_Win32GraphicsDevice.cpp
--- a/jdk/src/windows/native/sun/windows/awt_Win32GraphicsDevice.cpp	Wed Aug 13 13:27:43 2014 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_Win32GraphicsDevice.cpp	Wed Aug 13 21:45:53 2014 +0400
@@ -835,13 +835,17 @@
     TRY;
 
     /* class ids */
-    AwtWin32GraphicsDevice::indexCMClass =
-        (jclass)env->NewGlobalRef(env->FindClass("java/awt/image/IndexColorModel"));
+    jclass iCMClass = env->FindClass("java/awt/image/IndexColorModel");
+    CHECK_NULL(iCMClass);
+    AwtWin32GraphicsDevice::indexCMClass = (jclass) env->NewGlobalRef(iCMClass);
+    env->DeleteLocalRef(iCMClass);
     DASSERT(AwtWin32GraphicsDevice::indexCMClass);
     CHECK_NULL(AwtWin32GraphicsDevice::indexCMClass);
 
-    AwtWin32GraphicsDevice::wToolkitClass =
-        (jclass)env->NewGlobalRef(env->FindClass("sun/awt/windows/WToolkit"));
+    jclass wTClass = env->FindClass("sun/awt/windows/WToolkit");
+    CHECK_NULL(wTClass);
+    AwtWin32GraphicsDevice::wToolkitClass = (jclass)env->NewGlobalRef(wTClass);
+    env->DeleteLocalRef(wTClass);
     DASSERT(AwtWin32GraphicsDevice::wToolkitClass);
     CHECK_NULL(AwtWin32GraphicsDevice::wToolkitClass);