RFR: 8341789: Fix ExceptionOccurred in java.base

Daniel Fuchs dfuchs at openjdk.org
Thu Oct 10 09:34:12 UTC 2024


On Wed, 9 Oct 2024 17:28:09 GMT, Justin Lu <jlu at openjdk.org> wrote:

> Please review this PR which fixes incorrect usage of `jthrowable ExceptionOccurred(JNIEnv *env)` within _java.base_.
> 
> This corrects instances where the return value is being treated as a boolean. Such occurrences are replaced with `jboolean ExceptionCheck(JNIEnv *env)`.

Marked as reviewed by dfuchs (Reviewer).

>From https://docs.oracle.com/en/java/javase/23/docs/specs/jni/functions.html#exceptioncheck :

> ExceptionCheck
> We introduce a convenience function to check for pending exceptions without creating a local reference to the exception object.
> 
> jboolean ExceptionCheck(JNIEnv *env);
> 
> Returns JNI_TRUE when there is a pending exception; otherwise, returns JNI_FALSE.
> 

So this looks good to me too.

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

PR Review: https://git.openjdk.org/jdk/pull/21428#pullrequestreview-2359643144
PR Comment: https://git.openjdk.org/jdk/pull/21428#issuecomment-2404578043


More information about the nio-dev mailing list