mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-24 17:20:06 +00:00
7153184: NullPointerException when calling SSLEngineImpl.getSupportedCipherSuites
Reviewed-by: weijun
This commit is contained in:
parent
2f8d099c20
commit
7ae15519b1
@ -267,12 +267,15 @@ public abstract class SSLContextImpl extends SSLContextSpi {
|
||||
|
||||
// Get suported CipherSuiteList.
|
||||
CipherSuiteList getSuportedCipherSuiteList() {
|
||||
// Clear cache of available ciphersuites.
|
||||
clearAvailableCache();
|
||||
// The maintenance of cipher suites needs to be synchronized.
|
||||
synchronized (this) {
|
||||
// Clear cache of available ciphersuites.
|
||||
clearAvailableCache();
|
||||
|
||||
if (supportedCipherSuiteList == null) {
|
||||
supportedCipherSuiteList =
|
||||
getApplicableCipherSuiteList(getSuportedProtocolList(), false);
|
||||
if (supportedCipherSuiteList == null) {
|
||||
supportedCipherSuiteList = getApplicableCipherSuiteList(
|
||||
getSuportedProtocolList(), false);
|
||||
}
|
||||
}
|
||||
|
||||
return supportedCipherSuiteList;
|
||||
@ -280,20 +283,29 @@ public abstract class SSLContextImpl extends SSLContextSpi {
|
||||
|
||||
// Get default CipherSuiteList.
|
||||
CipherSuiteList getDefaultCipherSuiteList(boolean roleIsServer) {
|
||||
// Clear cache of available ciphersuites.
|
||||
clearAvailableCache();
|
||||
|
||||
if (roleIsServer) {
|
||||
if (defaultServerCipherSuiteList == null) {
|
||||
defaultServerCipherSuiteList = getApplicableCipherSuiteList(
|
||||
// The maintenance of cipher suites needs to be synchronized.
|
||||
synchronized (this) {
|
||||
// Clear cache of available ciphersuites.
|
||||
clearAvailableCache();
|
||||
|
||||
if (defaultServerCipherSuiteList == null) {
|
||||
defaultServerCipherSuiteList = getApplicableCipherSuiteList(
|
||||
getDefaultProtocolList(true), true);
|
||||
}
|
||||
}
|
||||
|
||||
return defaultServerCipherSuiteList;
|
||||
} else {
|
||||
if (defaultClientCipherSuiteList == null) {
|
||||
defaultClientCipherSuiteList = getApplicableCipherSuiteList(
|
||||
// The maintenance of cipher suites needs to be synchronized
|
||||
synchronized (this) {
|
||||
// Clear cache of available ciphersuites.
|
||||
clearAvailableCache();
|
||||
|
||||
if (defaultClientCipherSuiteList == null) {
|
||||
defaultClientCipherSuiteList = getApplicableCipherSuiteList(
|
||||
getDefaultProtocolList(false), true);
|
||||
}
|
||||
}
|
||||
|
||||
return defaultClientCipherSuiteList;
|
||||
@ -364,8 +376,11 @@ public abstract class SSLContextImpl extends SSLContextSpi {
|
||||
* Clear cache of available ciphersuites. If we support all ciphers
|
||||
* internally, there is no need to clear the cache and calling this
|
||||
* method has no effect.
|
||||
*
|
||||
* Note that every call to clearAvailableCache() and the maintenance of
|
||||
* cipher suites need to be synchronized with this instance.
|
||||
*/
|
||||
synchronized void clearAvailableCache() {
|
||||
private void clearAvailableCache() {
|
||||
if (CipherSuite.DYNAMIC_AVAILABILITY) {
|
||||
supportedCipherSuiteList = null;
|
||||
defaultServerCipherSuiteList = null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user