Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/jdk.jdwp.agent/share/native/libjdwp/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,12 @@ util_initialize(JNIEnv *env)
localAgentProperties =
JNI_FUNC_PTR(env,CallStaticObjectMethod)
(env, localVMSupportClass, getAgentProperties);
saveGlobalRef(env, localAgentProperties, &(gdata->agent_properties));
if (JNI_FUNC_PTR(env,ExceptionOccurred)(env)) {
JNI_FUNC_PTR(env,ExceptionClear)(env);
EXIT_ERROR(AGENT_ERROR_INTERNAL,
"Exception occurred calling VMSupport.getAgentProperties");
}
saveGlobalRef(env, localAgentProperties, &(gdata->agent_properties));
}

} END_WITH_LOCAL_REFS(env);
Expand Down
5 changes: 5 additions & 0 deletions test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,11 @@ sanity/client/SwingSet/src/ButtonDemoScreenshotTest.java 8265770 macosx-all
# core_tools


############################################################################

# core_svc
tools/launcher/TestXcheckJNIWarnings.java#jdwp-agent 8296936 generic-all

############################################################################

# jdk_jdi
Expand Down
24 changes: 19 additions & 5 deletions test/jdk/tools/launcher/TestXcheckJNIWarnings.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -25,14 +25,22 @@
import java.io.IOException;

/**
* @test
* @test id=noagent
* @bug 8187442
* @summary Launching app shouldn't produce any jni warnings.
* @modules jdk.compiler
* jdk.zipfs
* @compile TestXcheckJNIWarnings.java
* @run main TestXcheckJNIWarnings
*/

/**
* @test id=jdwp-agent
* @bug 8187442
* @summary Launching app with jdwp agent shouldn't produce any jni warnings.
* @modules jdk.compiler
* jdk.zipfs
* @run main TestXcheckJNIWarnings -agentlib:jdwp=transport=dt_socket,server=y,suspend=n
*/
public final class TestXcheckJNIWarnings extends TestHelper {

static void createJarFile(File testJar) throws IOException {
Expand All @@ -46,8 +54,14 @@ static void createJarFile(File testJar) throws IOException {
public static void main(String... args) throws IOException {
File testJarFile = new File("test.jar");
createJarFile(testJarFile);
TestResult tr = doExec(javaCmd, "-jar", "-Xcheck:jni",
testJarFile.getName());

TestResult tr;
if (args.length > 0) {
tr = doExec(javaCmd, "-jar", "-Xcheck:jni", args[0], testJarFile.getName());
} else {
tr = doExec(javaCmd, "-jar", "-Xcheck:jni", testJarFile.getName());
}

if (!tr.isOK()) {
System.out.println(tr);
throw new RuntimeException("test returned non-positive value");
Expand Down