RFR: 8336382: Fixes error reporting in loading AWT and fonts [v10]

Karm Michal Babacek duke at openjdk.org
Mon Jan 27 16:14:52 UTC 2025


On Mon, 20 Jan 2025 21:14:55 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Karm Michal Babacek has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Amended error message, doesn't clear exception
>
> 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

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

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


More information about the client-libs-dev mailing list