commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject [06/50] commons-crypto git commit: Statement unnecessarily nested within else clause.
Date Fri, 22 Jul 2016 07:00:34 GMT
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/5119f841
Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/5119f841
Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/5119f841

Branch: refs/heads/CRYPTO-1.0.0
Commit: 5119f8411967624382804dd96ebfb2e87d7fba96
Parents: a312850
Author: ggregory <ggregory@apache.org>
Authored: Fri Jul 8 09:16:38 2016 -0700
Committer: ggregory <ggregory@apache.org>
Committed: Fri Jul 8 09:16:38 2016 -0700

----------------------------------------------------------------------
 .../commons/crypto/random/OpenSslCryptoRandom.java      | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/5119f841/src/main/java/org/apache/commons/crypto/random/OpenSslCryptoRandom.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/crypto/random/OpenSslCryptoRandom.java b/src/main/java/org/apache/commons/crypto/random/OpenSslCryptoRandom.java
index e7f026f..d3877cb 100644
--- a/src/main/java/org/apache/commons/crypto/random/OpenSslCryptoRandom.java
+++ b/src/main/java/org/apache/commons/crypto/random/OpenSslCryptoRandom.java
@@ -84,14 +84,12 @@ class OpenSslCryptoRandom extends Random implements CryptoRandom {
         if (!nativeEnabled) {
             if (initException != null) {
                 throw new GeneralSecurityException("Native library could not be initialised",
initException);
-            } else {
-                throw new GeneralSecurityException("Native library is not loaded");
-            }
-        } else {
-            // Check that nextRandBytes works (is this really needed?)
-            if (!OpenSslCryptoRandomNative.nextRandBytes(new byte[1])) {
-                throw new GeneralSecurityException("Check of nextRandBytes failed");
             }
+            throw new GeneralSecurityException("Native library is not loaded");
+        }
+        // Check that nextRandBytes works (is this really needed?)
+        if (!OpenSslCryptoRandomNative.nextRandBytes(new byte[1])) {
+            throw new GeneralSecurityException("Check of nextRandBytes failed");
         }
     }
 


Mime
View raw message