Looks good, thanks Henry for fixing this.

Kumar

Hi,

Please review a trivial fix for 8081388, in a nutshell,

- Return NULL from NewPlatformStringArray if an exception occurred
- All other places call this function already handled return value NULL
- Launcher handles exception in JavaMain, report error and exit.

Cheers,
Henry

diff --git a/src/java.base/share/native/libjli/java.c 
b/src/java.base/share/native/libjli/java.c
--- a/src/java.base/share/native/libjli/java.c
+++ b/src/java.base/share/native/libjli/java.c
@@ -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);
diff --git a/src/java.base/share/native/libjli/java.h 
b/src/java.base/share/native/libjli/java.h
--- a/src/java.base/share/native/libjli/java.h
+++ b/src/java.base/share/native/libjli/java.h
@@ -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)) { \

Reply via email to