RFR: 8310628: GcInfoBuilder.c missing JNI Exception checks

Kevin Walls kevinw at openjdk.org
Fri Jun 23 17:42:02 UTC 2023


On Thu, 22 Jun 2023 10:10:07 GMT, Kevin Walls <kevinw at openjdk.org> wrote:

> JNI calls were identified, where we do not check for a pending Exception afterwards.
> 
> (JDK-8162530 cleaned up up some of these kind of issues some years back, but more were found.)
> 
> I tested a code change to manually create an Exception before some of the new ExceptionCheck calls, and this is correctly recognised, we see an Exception thrown by the native getLastGcInfo0, e.g. 
> 
> java.lang.NullPointerException: XXX Test Exception
>         at jdk.management/com.sun.management.internal.GcInfoBuilder.getLastGcInfo0(Native Method)
>         at jdk.management/com.sun.management.internal.GcInfoBuilder.getLastGcInfo(GcInfoBuilder.java:77)
>         at jdk.management/com.sun.management.internal.GarbageCollectorExtImpl.getLastGcInfo(GarbageCollectorExtImpl.java:69)
>         at LastGCInfo.main(LastGCInfo.java:53)
>         at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
>         at java.base/java.lang.reflect.Method.invoke(Method.java:580)
>         at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
>         at java.base/java.lang.Thread.run(Thread.java:1570)
> 
> Tested with all of test/jdk/com/sun/management including test/jdk/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java

Thanks David and Mandy for the Reviews!

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

PR Comment: https://git.openjdk.org/jdk/pull/14613#issuecomment-1604612071


More information about the serviceability-dev mailing list