changeset 17569:591a6dddaf28

8081388: JNI exception pending in jdk/src/windows/bin/java_md.c Reviewed-by: ksrini
author henryjen
date Wed, 31 Aug 2016 11:53:58 -0700
parents 85acda36fccb
children 02e6e285b1f7
files src/java.base/share/native/libjli/java.c src/java.base/share/native/libjli/java.h
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/native/libjli/java.c	Wed Aug 31 13:50:02 2016 -0700
+++ b/src/java.base/share/native/libjli/java.c	Wed Aug 31 11:53:58 2016 -0700
@@ -1497,6 +1497,7 @@
 
     NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String"));
     NULL_CHECK0(ary = (*env)->NewObjectArray(env, strc, cls, 0));
+    CHECK_EXCEPTION_RETURN_VALUE(0);
     for (i = 0; i < strc; i++) {
         jstring str = NewPlatformString(env, *strv++);
         NULL_CHECK0(str);
--- a/src/java.base/share/native/libjli/java.h	Wed Aug 31 13:50:02 2016 -0700
+++ b/src/java.base/share/native/libjli/java.h	Wed Aug 31 11:53:58 2016 -0700
@@ -253,6 +253,13 @@
 #define NULL_CHECK(NC_check_pointer) \
     NULL_CHECK_RETURN_VALUE(NC_check_pointer, )
 
+#define CHECK_EXCEPTION_RETURN_VALUE(CER_value) \
+    do { \
+        if ((*env)->ExceptionOccurred(env)) { \
+            return CER_value; \
+        } \
+    } while (JNI_FALSE)
+
 #define CHECK_EXCEPTION_RETURN() \
     do { \
         if ((*env)->ExceptionOccurred(env)) { \