Skip to content

Commit 71aac7a

Browse files
committed
8276809: java/awt/font/JNICheck/FreeTypeScalerJNICheck.java shows JNI warning on Windows
Reviewed-by: rschmelter, stuefe
1 parent 09c6c4f commit 71aac7a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -126,9 +126,15 @@ BOOL DWMIsCompositionEnabled() {
126126
dwmIsCompositionEnabled = bRes;
127127

128128
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
129-
JNU_CallStaticMethodByName(env, NULL,
129+
jboolean hasException;
130+
JNU_CallStaticMethodByName(env, &hasException,
130131
"sun/awt/Win32GraphicsEnvironment",
131132
"dwmCompositionChanged", "(Z)V", (jboolean)bRes);
133+
if (hasException) {
134+
J2dTraceLn(J2D_TRACE_INFO, "Exception occurred in DWMIsCompositionEnabled");
135+
env->ExceptionDescribe();
136+
env->ExceptionClear();
137+
}
132138
return bRes;
133139
}
134140

0 commit comments

Comments
 (0)