src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java
changeset 53018 8bf9268df0e2
parent 50768 68fa3d4026ea
child 53734 cb1642ccc732
--- a/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java	Thu Dec 13 16:14:07 2018 +0100
+++ b/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java	Thu Dec 13 15:31:05 2018 +0100
@@ -148,7 +148,7 @@
                 "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 @@
             // 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 @@
             // 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 @@
     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("]")) {