8068184: Fix for JDK-8032832 caused a deadlock
authoralitvinov
Thu, 21 Nov 2019 17:04:27 +0000
changeset 59207 7a3218ad8e7c
parent 59206 61091a42f19d
child 59208 ff7655b93101
child 59209 8a24f1e73c0d
8068184: Fix for JDK-8032832 caused a deadlock Reviewed-by: dfuchs, chegar
src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java
--- a/src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java	Thu Nov 21 16:33:00 2019 +0000
+++ b/src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java	Thu Nov 21 17:04:27 2019 +0000
@@ -31,7 +31,6 @@
 import java.util.Base64;
 import java.util.HashMap;
 import sun.net.www.HeaderParser;
-import sun.util.logging.PlatformLogger;
 import static sun.net.www.protocol.http.AuthScheme.NEGOTIATE;
 import static sun.net.www.protocol.http.AuthScheme.KERBEROS;
 import sun.security.action.GetPropertyAction;
@@ -47,7 +46,6 @@
 
     @java.io.Serial
     private static final long serialVersionUID = 100L;
-    private static final PlatformLogger logger = HttpURLConnection.getHttpLogger();
 
     @SuppressWarnings("serial") // Not statically typed as Serializable
     private final HttpCallerInfo hci;
@@ -93,31 +91,6 @@
     }
 
     /**
-     * Find out if the HttpCallerInfo supports Negotiate protocol.
-     * @return true if supported
-     */
-    public static boolean isSupported(HttpCallerInfo hci) {
-        ClassLoader loader = null;
-        try {
-            loader = Thread.currentThread().getContextClassLoader();
-        } catch (SecurityException se) {
-            if (logger.isLoggable(PlatformLogger.Level.FINER)) {
-                logger.finer("NegotiateAuthentication: " +
-                    "Attempt to get the context class loader failed - " + se);
-            }
-        }
-
-        if (loader != null) {
-            // Lock on the class loader instance to avoid the deadlock engaging
-            // the lock in "ClassLoader.loadClass(String, boolean)" method.
-            synchronized (loader) {
-                return isSupportedImpl(hci);
-            }
-        }
-        return isSupportedImpl(hci);
-    }
-
-    /**
      * Find out if the HttpCallerInfo supports Negotiate protocol. In order to
      * find out yes or no, an initialization of a Negotiator object against it
      * is tried. The generated object will be cached under the name of ths
@@ -128,7 +101,7 @@
      *
      * @return true if supported
      */
-    private static synchronized boolean isSupportedImpl(HttpCallerInfo hci) {
+    synchronized public static boolean isSupported(HttpCallerInfo hci) {
         if (supported == null) {
             supported = new HashMap<>();
         }