You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2016/06/30 00:02:29 UTC

[2/2] commons-crypto git commit: Statement unnecessarily nested within else clause.

Statement unnecessarily nested within else clause.

Project: http://git-wip-us.apache.org/repos/asf/commons-crypto/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-crypto/commit/9faf04e4
Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/9faf04e4
Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/9faf04e4

Branch: refs/heads/master
Commit: 9faf04e47dc66afc667abe85e0345565574efa09
Parents: 69b40ed
Author: Gary Gregory <gg...@apache.org>
Authored: Wed Jun 29 17:02:14 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Wed Jun 29 17:02:14 2016 -0700

----------------------------------------------------------------------
 .../commons/crypto/cipher/CryptoCipherFactory.java     | 13 ++++++-------
 .../commons/crypto/random/CryptoRandomFactory.java     |  9 ++++-----
 2 files changed, 10 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/9faf04e4/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java b/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java
index d6f908a..52c013d 100644
--- a/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java
+++ b/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java
@@ -133,14 +133,13 @@ public class CryptoCipherFactory {
 
         if (cipher != null) {
             return cipher;
-        } else {
-            if (errorMessage.length() == 0) {
-                throw new IllegalArgumentException("No classname(s) provided");
-            }
-            errorMessage.append(" is not available or transformation " +
-                    transformation + " is not supported.");
-            throw new GeneralSecurityException(errorMessage.toString());
         }
+        if (errorMessage.length() == 0) {
+            throw new IllegalArgumentException("No classname(s) provided");
+        }
+        errorMessage.append(" is not available or transformation " +
+                transformation + " is not supported.");
+        throw new GeneralSecurityException(errorMessage.toString());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/9faf04e4/src/main/java/org/apache/commons/crypto/random/CryptoRandomFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/crypto/random/CryptoRandomFactory.java b/src/main/java/org/apache/commons/crypto/random/CryptoRandomFactory.java
index ef20536..7319c7e 100644
--- a/src/main/java/org/apache/commons/crypto/random/CryptoRandomFactory.java
+++ b/src/main/java/org/apache/commons/crypto/random/CryptoRandomFactory.java
@@ -149,12 +149,11 @@ public class CryptoRandomFactory {
 
         if (random != null) {
             return random;
-        } else {
-            if (errorMessage.length() == 0) {
-                throw new IllegalArgumentException("No classname(s) provided");
-            }
-            throw new GeneralSecurityException(errorMessage.toString());
         }
+        if (errorMessage.length() == 0) {
+            throw new IllegalArgumentException("No classname(s) provided");
+        }
+        throw new GeneralSecurityException(errorMessage.toString());
     }
 
     /**