On Mon, 27 Jan 2025 16:12:34 GMT, Karm Michal Babacek <d...@openjdk.org> wrote:

>> src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c line 70:
>> 
>>> 68:         graphicsEnvClass = (*env)->FindClass(env,
>>> 69:                                              
>>> "java/awt/GraphicsEnvironment");
>>> 70:         CHECK_EXCEPTION_FATAL(env, "FindClass 
>>> java/awt/GraphicsEnvironment failed");
>> 
>> If `FindClass` fails to find the class, a `NoClassDefFoundError` should be 
>> raised. This function returns immediately (a value of `true`). The caller of 
>> this function should check if there's a pending exception and perform an 
>> appropriate action.
>> 
>> In this case, the function is called from
>> 
>> https://github.com/openjdk/jdk/blob/955bf185c38ec0fcedb0a549461fc85367b37fbb/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c#L130-L132
>> 
>> If there's a pending exception, it should bail out and let the exception be 
>> thrown on the Java side.
>> 
>> If it doesn't, the pending exception makes `JNU_NewStringPlatform` fail at
>> 
>> https://github.com/openjdk/jdk/blob/955bf185c38ec0fcedb0a549461fc85367b37fbb/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c#L149-L150
>> 
>> ---
>> 
>> Ah! There's no Java code to catch the exception… `AWT_OnLoad` is essentially 
>> `JNI_OnLoad`. In this case, `CHECK_EXCEPTION_FATAL` seems right.
>
> Hello @aivanov-jdk, 
> 
> Thank you for looking into the review.
> 
> Is there anything I can do to move things forward right now? It's not clear 
> to me whether you agree or disagree with the latest iteration inspired by 
> @mrserb 's review.
> 
> 
> Cheers
> Karm

Sorry, I didn't make myself clear.

Since there's no Java code to catch the exception, there's no other option but 
to call `(*env)->FatalError` via `CHECK_EXCEPTION_FATAL`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20169#discussion_r1933775711

Reply via email to