8192897: NPE occurs on clhsdb jstack

Reviewed-by: dholmes, sspitsyn, jgeorge, sballal
This commit is contained in:
Yasumasa Suenaga 2017-12-04 10:23:08 +09:00
parent 238ca2e781
commit 869aa96aa3
2 changed files with 18 additions and 6 deletions

View File

@ -128,6 +128,9 @@ public class CompiledVFrame extends JavaVFrame {
/** Returns List<MonitorInfo> */
public List<MonitorInfo> getMonitors() {
if (getScope() == null) {
return new ArrayList<>();
}
List monitors = getScope().getMonitors();
if (monitors == null) {
return new ArrayList<>();

View File

@ -38,14 +38,17 @@ import jdk.test.lib.Platform;
public class ClhsdbJstack {
public static void main(String[] args) throws Exception {
System.out.println("Starting ClhsdbJstack test");
private static void testJstack(boolean withXcomp) throws Exception {
LingeredApp theApp = null;
try {
ClhsdbLauncher test = new ClhsdbLauncher();
theApp = LingeredApp.startApp();
System.out.println("Started LingeredApp with pid " + theApp.getPid());
theApp = withXcomp ? LingeredApp.startApp(List.of("-Xcomp"))
: LingeredApp.startApp();
System.out.print("Started LingeredApp ");
if (withXcomp) {
System.out.print("(-Xcomp) ");
}
System.out.println("with pid " + theApp.getPid());
List<String> cmds = List.of("jstack -v");
@ -61,10 +64,16 @@ public class ClhsdbJstack {
test.run(theApp.getPid(), cmds, expStrMap, null);
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
throw new RuntimeException("Test ERROR (with -Xcomp=" + withXcomp + ") " + ex, ex);
} finally {
LingeredApp.stopApp(theApp);
}
}
public static void main(String[] args) throws Exception {
System.out.println("Starting ClhsdbJstack test");
testJstack(false);
testJstack(true);
System.out.println("Test PASSED");
}
}