RFR: 8344525: Fix leftover ExceptionOccurred in java.base
Alan Bateman
alanb at openjdk.org
Wed Nov 20 07:00:14 UTC 2024
On Wed, 20 Nov 2024 03:02:39 GMT, Justin Lu <jlu at openjdk.org> wrote:
> Please review this PR which removes the leftover ocurrences of incorrect JNI `ExceptionOccurred(env)` usage within _java.base_.
>
> This PR also includes 9 cases of `if (ExceptionOccurred(env) == NULL)`. While these occurrences are fine and were intentionally not removed during the first pass, it would be consistent with the other related JNI ExceptionOccurred cleanups to include them here as well. Making the swap also avoids creating the `jthrowable` reference in the first place (even if automatically freed later).
>
> After this patch, the remaining instances of `ExceptionOccurred(env)` within _j.base_ are used with intent to create the `jthrowable` reference.
Some of these were checking if ExceptionOccurred(env) returns NULL so were readable, moving them to ExceptionCheck is fine, and a bit more efficient when there is a pending exception.
-------------
Marked as reviewed by alanb (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/22266#pullrequestreview-2447595468
More information about the core-libs-dev
mailing list