8215281: Use String.isEmpty() when applicable in java.base

Reviewed-by: dfuchs, alanb
This commit is contained in:
Claes Redestad 2018-12-13 15:31:05 +01:00
parent c998ead188
commit a3df1d618e
155 changed files with 340 additions and 382 deletions

View file

@ -148,7 +148,7 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager
"null or zero-length certificate chain");
}
if (authType == null || authType.length() == 0) {
if (authType == null || authType.isEmpty()) {
throw new IllegalArgumentException(
"null or zero-length authentication type");
}
@ -229,7 +229,7 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager
// check endpoint identity
String identityAlg = sslSocket.getSSLParameters().
getEndpointIdentificationAlgorithm();
if (identityAlg != null && identityAlg.length() != 0) {
if (identityAlg != null && !identityAlg.isEmpty()) {
checkIdentity(session, trustedChain[0], identityAlg, isClient,
getRequestedServerNames(socket), chainsToPublicCA);
}
@ -287,7 +287,7 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager
// check endpoint identity
String identityAlg = engine.getSSLParameters().
getEndpointIdentificationAlgorithm();
if (identityAlg != null && identityAlg.length() != 0) {
if (identityAlg != null && !identityAlg.isEmpty()) {
checkIdentity(session, trustedChain[0], identityAlg, isClient,
getRequestedServerNames(engine), chainsToPublicCA);
}
@ -448,7 +448,7 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager
private static void checkIdentity(String hostname, X509Certificate cert,
String algorithm, boolean chainsToPublicCA)
throws CertificateException {
if (algorithm != null && algorithm.length() != 0) {
if (algorithm != null && !algorithm.isEmpty()) {
// if IPv6 strip off the "[]"
if ((hostname != null) && hostname.startsWith("[") &&
hostname.endsWith("]")) {