On Tue, 9 Nov 2021 19:22:18 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:
>> The new test java/awt/font/JNICheck/FreeTypeScalerJNICheck.java introduced >> with https://bugs.openjdk.java.net/browse/JDK-8269223 adds -Xcheck:jni to an >> awt related test, and shows on Windows server 2019 the following JNI warning >> , so the test JNICheck/FreeTypeScalerJNICheck.java fails on this Windows >> version. >> >> :stdErr: >> Thu Oct 28 01:27:10 CEST 2021 >> stdout: [WARNING in native method: JNI call made without checking exceptions >> when required to from CallStaticVoidMethodV >> at >> sun.awt.Win32GraphicsEnvironment.initDisplay(java.desktop@18.0.0.1-internal/Native >> Method) >> at >> sun.awt.Win32GraphicsEnvironment.initDisplayWrapper(java.desktop@18.0.0.1-internal/Win32GraphicsEnvironment.java:95) >> at >> sun.awt.Win32GraphicsEnvironment.<clinit>(java.desktop@18.0.0.1-internal/Win32GraphicsEnvironment.java:63) >> at >> sun.awt.PlatformGraphicsInfo.createGE(java.desktop@18.0.0.1-internal/PlatformGraphicsInfo.java:34) >> at >> java.awt.GraphicsEnvironment$LocalGE.createGE(java.desktop@18.0.0.1-internal/GraphicsEnvironment.java:93) >> at >> java.awt.GraphicsEnvironment$LocalGE.<clinit>(java.desktop@18.0.0.1-internal/GraphicsEnvironment.java:84) >> at >> java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(java.desktop@18.0.0.1-internal/GraphicsEnvironment.java:106) >> at >> FreeTypeScalerJNICheck.runTest(FreeTypeScalerJNICheck.java:53) >> at FreeTypeScalerJNICheck.main(FreeTypeScalerJNICheck.java:44) >> >> We can get rid of the warning by adjusting a JNU_CallStaticMethodByName call >> in awt_Win32GraphicsEnv.cpp . > > src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp line > 129: > >> 127: >> 128: JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); >> 129: JNU_CallStaticMethodByName(env, &ignoreException, > > As far as understand from the previous fix the "ignoreException" parameter > does not suppress the currently raised exception, it just suppresses the > warning in the XCheck:jni. So it will be good to propagate an exception to > the user if this code is executed on the "java" thread, and log it by the > trace macro if it is executed on a toolkit thread. Yeah this looks like the wrong fix. -Xcheck:jni only warns like this if there are actual exceptions, doesn't it ? So if we had one, where was it ? Note that Windows Server 2019 is a staple of the CI testing at Oracle and the test hasn't failed in the > 2 months since it was integrated, so I'm wondering why it fails in your case ? Was this a debug build perhaps ? ------------- PR: https://git.openjdk.java.net/jdk/pull/6306