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
Tue Jun 3 12:31:54 UTC 2025


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

>> src/java.desktop/unix/native/libawt_xawt/awt/screencast_pipewire.c line 1209:
>> 
>>> 1207:     AWT_UNLOCK();
>>> 1208: 
>>> 1209:     if (key == NoSymbol || (*env)->ExceptionCheck(env)) {
>> 
>> I guess we normally call ExceptionCheck after we call some JNI methods like (*env)->NewString or (*env)->CallObjectMethod. Here before this check we are not calling any JNI method so I think we should do it after we call (*env)->GetStringUTFChars ie. after l1214
>
>> we are not calling any JNI method
> 
> We have the `AWT_LOCK()` / `AWT_UNLOCK();` macro expansions with JNI methods being called.
> 
> https://github.com/openjdk/jdk/blob/78a392aa3b0cda52cfacfa15250fa61010519424/src/java.desktop/unix/native/common/awt/awt.h#L97-L110
> 
> This is exactly what static code analysis tool complains about.
> 
>>JNI exception pending in Java_sun_awt_screencast_ScreencastHelper_remoteDesktopKeyImpl of screencast_pipewire.c:1214

But we are calling ExceptionCheck in that macro in l104 so why do we again need to call?

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

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


More information about the client-libs-dev mailing list