< prev index next >

src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java

Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD

*** 146,156 **** if (chain == null || chain.length == 0) { throw new IllegalArgumentException( "null or zero-length certificate chain"); } ! if (authType == null || authType.length() == 0) { throw new IllegalArgumentException( "null or zero-length authentication type"); } Validator v = null; --- 146,156 ---- if (chain == null || chain.length == 0) { throw new IllegalArgumentException( "null or zero-length certificate chain"); } ! if (authType == null || authType.isEmpty()) { throw new IllegalArgumentException( "null or zero-length authentication type"); } Validator v = null;
*** 227,237 **** trustedChain[trustedChain.length-1]); // check endpoint identity String identityAlg = sslSocket.getSSLParameters(). getEndpointIdentificationAlgorithm(); ! if (identityAlg != null && identityAlg.length() != 0) { checkIdentity(session, trustedChain[0], identityAlg, isClient, getRequestedServerNames(socket), chainsToPublicCA); } } else { trustedChain = validate(v, chain, Collections.emptyList(), --- 227,237 ---- trustedChain[trustedChain.length-1]); // check endpoint identity String identityAlg = sslSocket.getSSLParameters(). getEndpointIdentificationAlgorithm(); ! if (identityAlg != null && !identityAlg.isEmpty()) { checkIdentity(session, trustedChain[0], identityAlg, isClient, getRequestedServerNames(socket), chainsToPublicCA); } } else { trustedChain = validate(v, chain, Collections.emptyList(),
*** 285,295 **** trustedChain[trustedChain.length-1]); // check endpoint identity String identityAlg = engine.getSSLParameters(). getEndpointIdentificationAlgorithm(); ! if (identityAlg != null && identityAlg.length() != 0) { checkIdentity(session, trustedChain[0], identityAlg, isClient, getRequestedServerNames(engine), chainsToPublicCA); } } else { trustedChain = validate(v, chain, Collections.emptyList(), --- 285,295 ---- trustedChain[trustedChain.length-1]); // check endpoint identity String identityAlg = engine.getSSLParameters(). getEndpointIdentificationAlgorithm(); ! if (identityAlg != null && !identityAlg.isEmpty()) { checkIdentity(session, trustedChain[0], identityAlg, isClient, getRequestedServerNames(engine), chainsToPublicCA); } } else { trustedChain = validate(v, chain, Collections.emptyList(),
*** 446,456 **** } private static void checkIdentity(String hostname, X509Certificate cert, String algorithm, boolean chainsToPublicCA) throws CertificateException { ! if (algorithm != null && algorithm.length() != 0) { // if IPv6 strip off the "[]" if ((hostname != null) && hostname.startsWith("[") && hostname.endsWith("]")) { hostname = hostname.substring(1, hostname.length() - 1); } --- 446,456 ---- } private static void checkIdentity(String hostname, X509Certificate cert, String algorithm, boolean chainsToPublicCA) throws CertificateException { ! if (algorithm != null && !algorithm.isEmpty()) { // if IPv6 strip off the "[]" if ((hostname != null) && hostname.startsWith("[") && hostname.endsWith("]")) { hostname = hostname.substring(1, hostname.length() - 1); }
< prev index next >