RFR: 8285397: JNI exception pending in CUPSfuncs.c:250

Phil Race prr at openjdk.java.net
Wed May 4 19:57:27 UTC 2022


On Mon, 2 May 2022 07:19:29 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> A tool checking for JNI errors complains that the call to JNU_NewStringPlatform(..)
>> might throw an exception and subsequent JNI code isn't making sure of that.
>> Clear the exception so the error handling code can do its thing.
>
> src/java.desktop/unix/native/common/awt/CUPSfuncs.c line 249:
> 
>> 247:             utf_str = JNU_NewStringPlatform(env, dests[i].name);
>> 248:             if (utf_str == NULL) {
>> 249:                 (*env)->ExceptionClear(env);
> 
> Shouldn't we also need to do same in https://github.com/openjdk/jdk/blob/master/src/java.desktop/unix/native/common/awt/CUPSfuncs.c#L357, L367, L381 since we do at L348

Nothing changed there, there's no complaint about that.
Perhaps the tool thinks it is OK to make the call to throw another exception ?
I'll ask about that.
FWIW if I go making changes to these places where there is no complaint I don't think I'd automatically clear
an exception in order to throw a different one .. I'd prefer to propagate the original.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8491



More information about the client-libs-dev mailing list