On 2/09/2016 2:03 AM, Henry Jen wrote:
That’s what I think too, this is just to silent parfait.
We are doing similar things in VM code, but the NULL check suffices. If
that is not the case here then I think a Parfait bug needs to be filed.
I don’t know for sure that we always get NULL with exception pending though.
If you didn't that would be a VM bug. Either you get an array returned
or you get NULL if the creation failed - the only way it can fail is if
some exception is thrown.
Thanks,
David
Cheers,
Henry
On September 1, 2016 at 12:34:02 AM, David Holmes (david.hol...@oracle.com)
wrote:
On 1/09/2016 5:51 AM, Henry Jen wrote:
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);
You will only get a NULL if an exception is pending; conversely you will
only have an exception pending if the return value is NULL. The new
check will never execute in a "positive way" and is unnecessary.
David
-----
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)) { \