< prev index next >

src/java.base/share/classes/javax/crypto/Cipher.java

Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()
Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad

@@ -529,11 +529,11 @@
      * @see java.security.Provider
      */
     public static final Cipher getInstance(String transformation)
             throws NoSuchAlgorithmException, NoSuchPaddingException
     {
-        if ((transformation == null) || transformation.equals("")) {
+        if ((transformation == null) || transformation.isEmpty()) {
             throw new NoSuchAlgorithmException("Null or empty transformation");
         }
         List<Transform> transforms = getTransforms(transformation);
         List<ServiceId> cipherServices = new ArrayList<>(transforms.size());
         for (Transform transform : transforms) {

@@ -629,11 +629,11 @@
     public static final Cipher getInstance(String transformation,
                                            String provider)
             throws NoSuchAlgorithmException, NoSuchProviderException,
             NoSuchPaddingException
     {
-        if ((transformation == null) || transformation.equals("")) {
+        if ((transformation == null) || transformation.isEmpty()) {
             throw new NoSuchAlgorithmException("Null or empty transformation");
         }
         if ((provider == null) || (provider.length() == 0)) {
             throw new IllegalArgumentException("Missing provider");
         }

@@ -696,11 +696,11 @@
      */
     public static final Cipher getInstance(String transformation,
                                            Provider provider)
             throws NoSuchAlgorithmException, NoSuchPaddingException
     {
-        if ((transformation == null) || transformation.equals("")) {
+        if ((transformation == null) || transformation.isEmpty()) {
             throw new NoSuchAlgorithmException("Null or empty transformation");
         }
         if (provider == null) {
             throw new IllegalArgumentException("Missing provider");
         }
< prev index next >