8081388: JNI exception pending in jdk/src/windows/bin/java_md.c
authorhenryjen
Wed, 31 Aug 2016 11:53:58 -0700
changeset 40695 7996b10bce66
parent 40694 759341b4bd03
child 40696 d38ae985f810
8081388: JNI exception pending in jdk/src/windows/bin/java_md.c Reviewed-by: ksrini
jdk/src/java.base/share/native/libjli/java.c
jdk/src/java.base/share/native/libjli/java.h
--- a/jdk/src/java.base/share/native/libjli/java.c	Wed Aug 31 13:50:02 2016 -0700
+++ b/jdk/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/jdk/src/java.base/share/native/libjli/java.h	Wed Aug 31 13:50:02 2016 -0700
+++ b/jdk/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)) { \