RFR: 8285399: JNI exception pending in awt_GraphicsEnv.c:1432

Phil Race prr at openjdk.java.net
Thu May 19 18:08:44 UTC 2022


On Thu, 19 May 2022 17:23:58 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

>> This is a theoretical/potential case of calling JNI methods with a possible execption pending.
>> As noted in the eval of the bug report, we no longer follow the practice that AWT_LOCK is
>> called only at the start of a native method and AWT_UNLOCK at the end, if indeed we ever did.
>> But it seems to be implied in how they are handling exceptions.
>
> src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c line 1432:
> 
>> 1430:         }
>> 1431:         (*env)->CallVoidMethod(env, this, midAddVisual, (visInfo[i]).visual);
>> 1432:         if ((*env)->ExceptionCheck(env)) {
> 
> Looks like this `if` block can be removed, since it is effectively handled by check above.

No .. that check is needed since CallVoidMethod() could raise an exception

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

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



More information about the client-libs-dev mailing list