8291509: Minor cleanup could be done in sun.security

Reviewed-by: weijun
This commit is contained in:
Mark Powers 2022-09-15 19:59:53 +00:00 committed by Weijun Wang
parent 6beeb8471c
commit 4cec141a90
298 changed files with 2650 additions and 3262 deletions

View file

@ -73,7 +73,7 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager
this.pkixParams = null;
if (trustedCerts == null) {
trustedCerts = Collections.<X509Certificate>emptySet();
trustedCerts = Collections.emptySet();
}
this.trustedCerts = trustedCerts;
@ -172,7 +172,7 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager
}
}
} else {
// assume double checked locking with a volatile flag works
// assume double-checked locking with a volatile flag works
// (guaranteed under the new Tiger memory model)
v = serverValidator;
if (v == null) {
@ -199,9 +199,8 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager
X509Certificate[] trustedChain;
if ((socket != null) && socket.isConnected() &&
(socket instanceof SSLSocket)) {
(socket instanceof SSLSocket sslSocket)) {
SSLSocket sslSocket = (SSLSocket)socket;
SSLSession session = sslSocket.getHandshakeSession();
if (session == null) {
throw new CertificateException("No handshake session");
@ -356,7 +355,7 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager
((SSLSocket)socket).getHandshakeSession());
}
return Collections.<SNIServerName>emptyList();
return Collections.emptyList();
}
// Also used by X509KeyManagerImpl
@ -365,7 +364,7 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager
return getRequestedServerNames(engine.getHandshakeSession());
}
return Collections.<SNIServerName>emptyList();
return Collections.emptyList();
}
private static List<SNIServerName> getRequestedServerNames(
@ -374,7 +373,7 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager
return ((ExtendedSSLSession)session).getRequestedServerNames();
}
return Collections.<SNIServerName>emptyList();
return Collections.emptyList();
}
/*
@ -390,7 +389,7 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager
* is not always a reliable fully qualified domain name. The HostName in
* server_name extension is more reliable than peer host. So we prefer
* the identity checking against the server_name extension if present, and
* may failove to peer host checking.
* may failover to peer host checking.
*/
static void checkIdentity(SSLSession session,
X509Certificate[] trustedChain,
@ -423,7 +422,7 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager
throw ce;
}
// otherwisw, failover to check peer host
// otherwise, failover to check peer host
}
}
}