7167092: Need to put the return clause in the synchronized block
authorxuelei
Tue, 08 May 2012 17:56:18 -0700
changeset 12677 2b25f3fc4f81
parent 12676 3b7fae360d04
child 12678 e40db477dd56
7167092: Need to put the return clause in the synchronized block Summary: a regression fix for bug 7153184 Reviewed-by: wetmore
jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java
--- a/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java	Tue May 08 11:16:36 2012 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java	Tue May 08 17:56:18 2012 -0700
@@ -276,39 +276,33 @@
                 supportedCipherSuiteList = getApplicableCipherSuiteList(
                         getSuportedProtocolList(), false);
             }
+
+            return supportedCipherSuiteList;
         }
-
-        return supportedCipherSuiteList;
     }
 
     // Get default CipherSuiteList.
     CipherSuiteList getDefaultCipherSuiteList(boolean roleIsServer) {
-        if (roleIsServer) {
-            // The maintenance of cipher suites needs to be synchronized.
-            synchronized (this) {
-                // Clear cache of available ciphersuites.
-                clearAvailableCache();
+        // The maintenance of cipher suites needs to be synchronized.
+        synchronized (this) {
+            // Clear cache of available ciphersuites.
+            clearAvailableCache();
 
+            if (roleIsServer) {
                 if (defaultServerCipherSuiteList == null) {
                     defaultServerCipherSuiteList = getApplicableCipherSuiteList(
                         getDefaultProtocolList(true), true);
                 }
-            }
 
-            return defaultServerCipherSuiteList;
-        } else {
-            // The maintenance of cipher suites needs to be synchronized
-            synchronized (this) {
-                // Clear cache of available ciphersuites.
-                clearAvailableCache();
-
+                return defaultServerCipherSuiteList;
+            } else {
                 if (defaultClientCipherSuiteList == null) {
                     defaultClientCipherSuiteList = getApplicableCipherSuiteList(
                         getDefaultProtocolList(false), true);
                 }
+
+                return defaultClientCipherSuiteList;
             }
-
-            return defaultClientCipherSuiteList;
         }
     }