8214295: Populate handlers while holding streamHandlerLock
authorcoffeys
Tue, 27 Nov 2018 11:09:53 +0000
changeset 52694 93afbb11063b
parent 52693 0037ea3c7322
child 52695 99eb43bc3595
8214295: Populate handlers while holding streamHandlerLock Reviewed-by: chegar
src/java.base/share/classes/java/net/URL.java
--- a/src/java.base/share/classes/java/net/URL.java	Mon Nov 26 17:35:35 2018 +0100
+++ b/src/java.base/share/classes/java/net/URL.java	Tue Nov 27 11:09:53 2018 +0000
@@ -1421,13 +1421,12 @@
                 // this thread created.
                 handler = handler2;
             }
+
+            // Insert this handler into the hashtable
+            if (handler != null) {
+                handlers.put(protocol, handler);
+            }
         }
-
-        // Insert this handler into the hashtable
-        if (handler != null) {
-            handlers.put(protocol, handler);
-        }
-
         return handler;
     }