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

Alexander Zvegintsev azvegint at openjdk.java.net
Thu May 19 18:15:40 UTC 2022


On Thu, 19 May 2022 18:05:10 GMT, Phil Race <prr at openjdk.org> wrote:

>> 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

Sure, it can, but:

- if there is another iteration to do it will be handled by check on line `1428` and will break the cycle.
- if it is the last iteration there is no need to break since `CallVoidMethod()` is last statement in cycle.

Do I missing something?

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

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



More information about the client-libs-dev mailing list