OpenJDK / jdk8u / jdk8u / jdk
changeset 9290:8d06c4bb0738
8035335: [parfait] JNI exception pending in jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp
Reviewed-by: serb, anthony
author | pchelko |
---|---|
date | Mon, 31 Mar 2014 16:59:08 +0400 |
parents | 4a8678018b9e |
children | 2888197f4d0b |
files | src/windows/native/sun/windows/awt_TrayIcon.cpp |
diffstat | 1 files changed, 23 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/windows/native/sun/windows/awt_TrayIcon.cpp Mon Mar 31 16:55:55 2014 +0400 +++ b/src/windows/native/sun/windows/awt_TrayIcon.cpp Mon Mar 31 16:59:08 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"); - AwtTrayIcon::actionCommandID = env->GetFieldID(cls, "actionCommand", "Ljava/lang/String;"); + DASSERT(AwtTrayIcon::idID != NULL); + CHECK_NULL(AwtTrayIcon::idID); - DASSERT(AwtTrayIcon::idID != NULL); + AwtTrayIcon::actionCommandID = env->GetFieldID(cls, "actionCommand", "Ljava/lang/String;"); 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) {