RFR: JDK-8210252: com/sun/jdi/DebuggerThreadTest.java fails with NPE
Gary Adams
gary.adams at oracle.com
Tue Sep 4 12:22:10 UTC 2018
Here's a quick fix to avoid the NPE using a getThreadGroup() which could
be null
if the thread has terminated.
Issue: https://bugs.openjdk.java.net/browse/JDK-8210252
diff --git a/test/jdk/com/sun/jdi/DebuggerThreadTest.java
b/test/jdk/com/sun/jdi/DebuggerThreadTest.java
--- a/test/jdk/com/sun/jdi/DebuggerThreadTest.java
+++ b/test/jdk/com/sun/jdi/DebuggerThreadTest.java
@@ -77,7 +77,8 @@
int gotThreads = tg.enumerate(list, true);
for (int i = 0; i < Math.min(gotThreads, list.length); i++){
Thread t = list[i];
- String groupName = t.getThreadGroup().getName();
+ ThreadGroup tga = t.getThreadGroup();
+ String groupName = (tga == null ? "<completed>": tga.getName());
System.out.println("Thread [" + i + "] group = '" +
groupName +
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20180904/4611d854/attachment.html>
More information about the serviceability-dev
mailing list