diff --git a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackPrintVMLocks.java b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackPrintVMLocks.java index ff1cc4b96bd..e46306cf8d3 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackPrintVMLocks.java +++ b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackPrintVMLocks.java @@ -79,7 +79,10 @@ public class TestJhsdbJstackPrintVMLocks { } throw new RuntimeException("Not able to find lock"); } finally { - theApp.getProcess().destroyForcibly(); + if (theApp.getProcess() != null) { + theApp.deleteLock(); + theApp.getProcess().destroyForcibly(); + } } } }