changeset 23322:d3267402aaae

8035335: [parfait] JNI exception pending in jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp Reviewed-by: serb, anthony
author pchelko
date Wed, 26 Feb 2014 11:55:45 +0400
parents 7f1737ac8b30
children f44d37f9351c
files jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp
diffstat 1 files changed, 23 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp	Tue Feb 25 17:37:55 2014 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp	Wed Feb 26 11:55:45 2014 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -503,6 +503,7 @@
             env->GetMethodID(mouseEventCls, "<init>",
                              "(Ljava/awt/Component;IJIIIIIIZI)V");
         DASSERT(mouseEventConst);
+        CHECK_NULL(mouseEventConst);
     }
     if (env->EnsureLocalCapacity(2) < 0) {
         return;
@@ -556,6 +557,7 @@
             env->GetMethodID(actionEventCls, "<init>",
                              "(Ljava/lang/Object;ILjava/lang/String;JI)V");
         DASSERT(actionEventConst);
+        CHECK_NULL(actionEventConst);
     }
     if (env->EnsureLocalCapacity(2) < 0) {
         return;
@@ -736,6 +738,7 @@
     }
 
     tooltipStr = JNU_GetStringPlatformChars(env, jtooltip, (jboolean *)NULL);
+    if (env->ExceptionCheck()) goto ret;
     trayIcon->SetToolTip(tooltipStr);
     JNU_ReleaseStringPlatformChars(env, jtooltip, tooltipStr);
 ret:
@@ -855,9 +858,18 @@
     trayIcon = (AwtTrayIcon *)pData;
 
     captionStr = JNU_GetStringPlatformChars(env, jcaption, (jboolean *)NULL);
+    if (env->ExceptionCheck()) goto ret;
     textStr = JNU_GetStringPlatformChars(env, jtext, (jboolean *)NULL);
+    if (env->ExceptionCheck()) {
+        JNU_ReleaseStringPlatformChars(env, jcaption, captionStr);
+        goto ret;
+    }
     msgTypeStr = JNU_GetStringPlatformChars(env, jmsgType, (jboolean *)NULL);
-
+    if (env->ExceptionCheck()) {
+        JNU_ReleaseStringPlatformChars(env, jcaption, captionStr);
+        JNU_ReleaseStringPlatformChars(env, jtext, textStr);
+        goto ret;
+    }
     trayIcon->DisplayMessage(captionStr, textStr, msgTypeStr);
 
     JNU_ReleaseStringPlatformChars(env, jcaption, captionStr);
@@ -889,10 +901,12 @@
 
     /* init field ids */
     AwtTrayIcon::idID = env->GetFieldID(cls, "id", "I");
+    DASSERT(AwtTrayIcon::idID != NULL);
+    CHECK_NULL(AwtTrayIcon::idID);
+
     AwtTrayIcon::actionCommandID = env->GetFieldID(cls, "actionCommand", "Ljava/lang/String;");
-
-    DASSERT(AwtTrayIcon::idID != NULL);
     DASSERT(AwtTrayIcon::actionCommandID != NULL);
+    CHECK_NULL( AwtTrayIcon::actionCommandID);
 
     CATCH_BAD_ALLOC;
 }
@@ -981,8 +995,11 @@
     jint *intRasterDataPtr = NULL;
     HBITMAP hColor = NULL;
     try {
-        intRasterDataPtr =
-            (jint *)env->GetPrimitiveArrayCritical(intRasterData, 0);
+        intRasterDataPtr = (jint *)env->GetPrimitiveArrayCritical(intRasterData, 0);
+        if (intRasterDataPtr == NULL) {
+            ::DeleteObject(hMask);
+            return;
+        }
         hColor = AwtTrayIcon::CreateBMP(NULL, (int *)intRasterDataPtr, nSS, nW, nH);
     } catch (...) {
         if (intRasterDataPtr != NULL) {