Skip to content

Commit 2d511cf

Browse files
committed
[GR-69017] Fix pending JNI exception leak in native-image-agent.
PullRequest: graal/22037
2 parents 91e3748 + 3e1d095 commit 2d511cf

File tree

1 file changed

+4
-1
lines changed
  • substratevm/src/com.oracle.svm.jvmtiagentbase/src/com/oracle/svm/jvmtiagentbase

1 file changed

+4
-1
lines changed

substratevm/src/com.oracle.svm.jvmtiagentbase/src/com/oracle/svm/jvmtiagentbase/Support.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,11 @@ public static JNIObjectHandle getReceiver(JNIObjectHandle thread) {
211211
public static String getClassNameOr(JNIEnvironment env, JNIObjectHandle clazz, String forNullHandle, String forNullNameOrException) {
212212
if (clazz.notEqual(nullHandle())) {
213213
JNIObjectHandle clazzName = callObjectMethod(env, clazz, JvmtiAgentBase.singleton().handles().javaLangClassGetName);
214+
if (clearException(env)) {
215+
return forNullNameOrException;
216+
}
214217
String result = Support.fromJniString(env, clazzName);
215-
if (result == null || clearException(env)) {
218+
if (result == null) {
216219
result = forNullNameOrException;
217220
}
218221
return result;

0 commit comments

Comments
 (0)