7167092: Need to put the return clause in the synchronized block

A regression fix for bug 7153184

Reviewed-by: wetmore
This commit is contained in:
Xue-Lei Andrew Fan 2012-05-08 17:56:18 -07:00
parent 30fb5c8146
commit f44a8ebe07

View File

@ -276,39 +276,33 @@ public abstract class SSLContextImpl extends SSLContextSpi {
supportedCipherSuiteList = getApplicableCipherSuiteList( supportedCipherSuiteList = getApplicableCipherSuiteList(
getSuportedProtocolList(), false); getSuportedProtocolList(), false);
} }
}
return supportedCipherSuiteList; return supportedCipherSuiteList;
}
} }
// Get default CipherSuiteList. // Get default CipherSuiteList.
CipherSuiteList getDefaultCipherSuiteList(boolean roleIsServer) { CipherSuiteList getDefaultCipherSuiteList(boolean roleIsServer) {
if (roleIsServer) { // The maintenance of cipher suites needs to be synchronized.
// The maintenance of cipher suites needs to be synchronized. synchronized (this) {
synchronized (this) { // Clear cache of available ciphersuites.
// Clear cache of available ciphersuites. clearAvailableCache();
clearAvailableCache();
if (roleIsServer) {
if (defaultServerCipherSuiteList == null) { if (defaultServerCipherSuiteList == null) {
defaultServerCipherSuiteList = getApplicableCipherSuiteList( defaultServerCipherSuiteList = getApplicableCipherSuiteList(
getDefaultProtocolList(true), true); 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) { if (defaultClientCipherSuiteList == null) {
defaultClientCipherSuiteList = getApplicableCipherSuiteList( defaultClientCipherSuiteList = getApplicableCipherSuiteList(
getDefaultProtocolList(false), true); getDefaultProtocolList(false), true);
} }
}
return defaultClientCipherSuiteList; return defaultClientCipherSuiteList;
}
} }
} }