# HG changeset patch # User gadams # Date 1536839678 14400 # Node ID dc68380e64973a2364f41ec87178b78a3204fed5 # Parent 8745f8f1b0f8cf105a9e503cd8e037186e5cc509 8210252: com/sun/jdi/DebuggerThreadTest.java fails with NPE Reviewed-by: cjplummer, sspitsyn diff -r 8745f8f1b0f8 -r dc68380e6497 test/jdk/com/sun/jdi/DebuggerThreadTest.java --- a/test/jdk/com/sun/jdi/DebuggerThreadTest.java Thu Sep 13 15:27:21 2018 -0700 +++ b/test/jdk/com/sun/jdi/DebuggerThreadTest.java Thu Sep 13 07:54:38 2018 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,6 +66,7 @@ * Move to top ThreadGroup and dump all threads. */ public void dumpThreads() { + int finishedThreads = 0; ThreadGroup tg = Thread.currentThread().getThreadGroup(); ThreadGroup parent = tg.getParent(); while (parent != null) { @@ -77,7 +78,14 @@ 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; + if (tga == null) { + groupName = ""; + finishedThreads++ ; + } else { + groupName = tga.getName(); + } System.out.println("Thread [" + i + "] group = '" + groupName + @@ -89,7 +97,10 @@ failure("FAIL: non-daemon thread '" + t.getName() + "' found in ThreadGroup '" + groupName + "'"); } - + } + if (finishedThreads > 0 ) { + failure("FAIL: " + finishedThreads + + " threads completed while VM suspended."); } }