From 8f08020fa452b15709f68a702abb5edec191dee2 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Mon, 25 Nov 2024 01:31:16 +0000 Subject: [PATCH] 8344903: Improve error handling TestJhsdbJstackPrintVMLocks.java Reviewed-by: lmesnik, dholmes --- .../jtreg/serviceability/sa/TestJhsdbJstackPrintVMLocks.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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(); + } } } }