[OpenJDK 2D-Dev] RFR: 8269223: -Xcheck:jni WARNINGs working with fonts on Linux [v3]

Sergey Bylokhov serb at openjdk.java.net
Sat Jul 17 03:11:48 UTC 2021

On Wed, 14 Jul 2021 05:48:42 GMT, Maxim Kartashev <github.com+28651297+mkartashev at openjdk.org> wrote:

>> Added an `ExceptionCheck()` followed by `ExceptionDescribe()` and `ExceptionClear()` immediately after the Java calls made from the callback function `ReadTTFontFileFunc()` in `freetypeScaler.c`. 
>> The exception(s) need to be cleared because we're not returning immediately to Java that would've been able to handle them gracefully. And in order not to loose the exception entirely (even though the return value would also indicate an error condition), print out the exception with `ExceptionDescribe()` to aid in debugging.
> Maxim Kartashev has updated the pull request incrementally with one additional commit since the last revision:
>   1. Marked the test as headful so that it doesn't fail on a headless
>   system.
>   2. Added exception checks to Windows-specific code.

src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderQueue.cpp line 870:

> 868:         J2dTraceLn(J2D_TRACE_VERBOSE, "  executing runnable");
> 869:         jboolean ignoreException;
> 870:         JNU_CallMethodByName(env, &ignoreException, pFlush->runnable, "run", "()V");

What is the purpose of this change? the only difference is that in the second case the ExceptionCheck will be called, does it affect something?

src/java.desktop/windows/native/libawt/windows/awt_Component.cpp line 6575:

> 6573:     jintArray obj = (jintArray)JNU_CallStaticMethodByName(env, &ignoreException,
> 6574:                                                           "java/awt/event/InputEvent",
> 6575:                                                           "getButtonDownMasks", "()[I").l;

obj might be null? Can not we just add CHECK_NULL(obj) here?


PR: https://git.openjdk.java.net/jdk/pull/4572

More information about the 2d-dev mailing list