changeset 41130:2004bf22423f

8166059: JSR166TestCase.java fails with NPE in dumpTestThreads on timeout Reviewed-by: martin, chegar, shade
author dl
date Fri, 23 Sep 2016 13:21:23 -0700
parents e54fb9880260
children 87edc8451f8a
files jdk/test/java/util/concurrent/tck/JSR166TestCase.java
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/test/java/util/concurrent/tck/JSR166TestCase.java	Fri Sep 23 13:18:22 2016 -0700
+++ b/jdk/test/java/util/concurrent/tck/JSR166TestCase.java	Fri Sep 23 13:21:23 2016 -0700
@@ -1032,14 +1032,17 @@
         ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
         System.err.println("------ stacktrace dump start ------");
         for (ThreadInfo info : threadMXBean.dumpAllThreads(true, true)) {
-            String name = info.getThreadName();
+            final String name = info.getThreadName();
+            String lockName;
             if ("Signal Dispatcher".equals(name))
                 continue;
             if ("Reference Handler".equals(name)
-                && info.getLockName().startsWith("java.lang.ref.Reference$Lock"))
+                && (lockName = info.getLockName()) != null
+                && lockName.startsWith("java.lang.ref.Reference$Lock"))
                 continue;
             if ("Finalizer".equals(name)
-                && info.getLockName().startsWith("java.lang.ref.ReferenceQueue$Lock"))
+                && (lockName = info.getLockName()) != null
+                && lockName.startsWith("java.lang.ref.ReferenceQueue$Lock"))
                 continue;
             if ("checkForWedgedTest".equals(name))
                 continue;
@@ -1783,7 +1786,7 @@
      * A CyclicBarrier that uses timed await and fails with
      * AssertionFailedErrors instead of throwing checked exceptions.
      */
-    public class CheckedBarrier extends CyclicBarrier {
+    public static class CheckedBarrier extends CyclicBarrier {
         public CheckedBarrier(int parties) { super(parties); }
 
         public int await() {