diff -r fe435c741ec8 -r de44744708a2 jdk/src/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java --- a/jdk/src/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java Mon Feb 08 23:02:28 2010 -0800 +++ b/jdk/src/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java Wed Feb 10 13:23:50 2010 +0000 @@ -111,7 +111,7 @@ * at the same time, then all but the first will block until * the first completes its authentication. */ - static private HashMap requests = new HashMap (); + static private HashMap requests = new HashMap<>(); /* check if a request for this destination is in progress * return false immediately if not. Otherwise block until @@ -125,7 +125,7 @@ synchronized (requests) { Thread t, c; c = Thread.currentThread(); - if ((t=(Thread)requests.get(key))==null) { + if ((t = requests.get(key)) == null) { requests.put (key, c); return false; } @@ -147,8 +147,11 @@ */ static private void requestCompleted (String key) { synchronized (requests) { - boolean waspresent = requests.remove (key) != null; - assert waspresent; + Thread thread = requests.get(key); + if (thread != null && thread == Thread.currentThread()) { + boolean waspresent = requests.remove(key) != null; + assert waspresent; + } requests.notifyAll(); } }