RFR: 8358452: JNI exception pending in Java_sun_awt_screencast_ScreencastHelper_remoteDesktopKeyImpl of screencast_pipewire.c:1214 (ID: 51119)

Prasanta Sadhukhan psadhukhan at openjdk.org
Wed Jun 4 03:51:15 UTC 2025


On Tue, 3 Jun 2025 14:05:24 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

>> But then it should show JNI exception pending for all places where we call AWT_UNLOCK, why only this place?
>
> This is not the only place. Other cases are also covered by checking for pending exceptions or by returning to Java. If not, the code analysis tool may not detect it for some reason.

We call AWT_UNLOCK in awt_Robot.c, gtk3_interface.c, awt_GraphicsEnv.c where there's no ExceptionCheck after the call.
For example, here ExceptionCheck is called not after AWT_UNLOCK but after the next JNI call `(*env)->NewObject`
https://github.com/openjdk/jdk/blob/ebd85288ce309b7dc7ff8b36558dd9f2a2300209/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c#L1281-L1290

Normally we do ExceptionCheck after GetStringUTFChars
https://github.com/openjdk/jdk/blob/ebd85288ce309b7dc7ff8b36558dd9f2a2300209/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp#L1192-L1193

Did you verify the warning goes off only by this PR change? If not, I will also recommend doing CHECK_EXCEPTION after GetStringUTFChars too..

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25605#discussion_r2125538565


More information about the client-libs-dev mailing list