RFR: JDK-8210252: com/sun/jdi/DebuggerThreadTest.java fails with NPE

Chris Plummer chris.plummer at oracle.com
Tue Sep 4 17:51:10 UTC 2018


Hi Gary,

Why has the thread exited if the debuggee is still running?

Chris

On 9/4/18 5:22 AM, Gary Adams wrote:
> 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 + 




More information about the serviceability-dev mailing list