7042673: LockSupport.getBlocker(null) crashes
authordl
Mon, 09 May 2011 16:36:20 +0100
changeset 9675 5aaa241a1c44
parent 9674 5d8476e6e47a
child 9677 638762c0263e
7042673: LockSupport.getBlocker(null) crashes Reviewed-by: chegar
jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java
--- a/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java	Mon May 09 15:58:25 2011 +0100
+++ b/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java	Mon May 09 16:36:20 2011 +0100
@@ -275,10 +275,14 @@
      * snapshot -- the thread may have since unblocked or blocked on a
      * different blocker object.
      *
+     * @param t the thread
      * @return the blocker
+     * @throws NullPointerException if argument is null
      * @since 1.6
      */
     public static Object getBlocker(Thread t) {
+        if (t == null)
+            throw new NullPointerException();
         return unsafe.getObjectVolatile(t, parkBlockerOffset);
     }