< prev index next >

src/java.base/share/classes/java/security/Signature.java

Print this page
rev 51919 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb

@@ -358,11 +358,11 @@
     public static Signature getInstance(String algorithm, String provider)
             throws NoSuchAlgorithmException, NoSuchProviderException {
         Objects.requireNonNull(algorithm, "null algorithm name");
         if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
             // exception compatibility with existing code
-            if ((provider == null) || (provider.length() == 0)) {
+            if (provider == null || provider.isEmpty()) {
                 throw new IllegalArgumentException("missing provider");
             }
             Provider p = Security.getProvider(provider);
             if (p == null) {
                 throw new NoSuchProviderException
< prev index next >