8296709: WARNING: JNI call made without checking exceptions
Reviewed-by: kevinw, sspitsyn, clanger
This commit is contained in:
parent
4946737fcb
commit
eac26f4eb2
src/jdk.jdwp.agent/share/native/libjdwp
test/jdk
@ -275,12 +275,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);
|
||||
|
@ -691,6 +691,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
|
||||
|
@ -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
|
||||
@ -25,14 +25,22 @@ import java.io.File;
|
||||
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 {
|
||||
@ -46,8 +54,14 @@ public final class TestXcheckJNIWarnings extends TestHelper {
|
||||
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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user