< prev index next >

src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java

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

@@ -133,11 +133,11 @@
      */
     @Override
     public final boolean permits(Set<CryptoPrimitive> primitives,
             String algorithm, Key key, AlgorithmParameters parameters) {
 
-        if (algorithm == null || algorithm.length() == 0) {
+        if (algorithm == null || algorithm.isEmpty()) {
             throw new IllegalArgumentException("No algorithm name specified");
         }
 
         return checkConstraints(primitives, algorithm, key, parameters);
     }

@@ -186,11 +186,11 @@
         if (key == null) {
             throw new IllegalArgumentException("The key cannot be null");
         }
 
         // check the signature algorithm with parameters
-        if (algorithm != null && algorithm.length() != 0) {
+        if (algorithm != null && !algorithm.isEmpty()) {
             if (!permits(primitives, algorithm, parameters)) {
                 return false;
             }
         }
 
< prev index next >