RFR : JDK-8046545 launcher fix to check function return values
Kumar Srinivasan
kumar.x.srinivasan at oracle.com
Sat Jul 19 15:02:49 UTC 2014
[ Since I am sponsoring this patch, I think jcheck needs one more
Reviewer besides myself]
Neil,
looking at your webrev: http://cr.openjdk.java.net/~ntoda/8046545/webrev-02/
Can we not re-use the existing macro for null check ?
#define NULL_CHECK_RETURN_VALUE(NCRV_check_pointer, NCRV_return_value)
so thus your new macro would become....
+#define CHECK_JNI_RETURN(JNIRETURN, RETURNVALUE) \
+ CHECK_JNI_RETURN_EXCEPTION(RETURNVALUE); \
- do { \
- if ((JNIRETURN) == NULL) { \
- JLI_ReportErrorMessage(JNI_ERROR); \
- RETURNVALUE; \
- } \
- } while (JNI_FALSE)
+ NULL_CHECK_RETURN_VALUE(JNI_RETURN, RETURN_VALUE);
Kumar
On 7/18/2014 10:40 AM, Neil Toda wrote:
>
> Thanks Kumar. Yes, misspoke here. Will correct the comment.
>
> On 7/18/2014 10:35 AM, Kumar Srinivasan wrote:
>> Neil,
>> The fix looks good. However there is an inaccuracy in the comment:
>>
>> + * Normally, JNI calls do not return if an exception is thrown.
>> + * However, this behavior can change in the future,
>> + * so check for thrown exceptions.
>>
>> This is not true, JNI calls *will* return if an exception is thrown,
>> however best
>> JNI practices dictate that a pending Exception(s) must be cleared or
>> caught, before
>> attempting another JNI call. Under such circumstances the return
>> value will usually
>> be an error or a null value. I suggest making this change to reflect
>> this.
>>
>> Thanks
>> Kumar
>>
>>
>>
>> On 7/18/2014 9:53 AM, Neil Toda wrote:
>>>
>>> Please review this launcher change.
>>>
>>> Issue: https://bugs.openjdk.java.net/browse/JDK-8046545
>>> webrev: http://cr.openjdk.java.net/~ntoda/8046545/webrev-01/
>>>
>>> Summary:
>>>
>>> Introduce a set of macros for launcher to be used to check for
>>> certain conditions after
>>> return from select functions.
>>>
>>>
>>
>
More information about the core-libs-dev
mailing list