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/07/08 16:16:40 UTC

commons-crypto git commit: Statement unnecessarily nested within else clause.

Repository: commons-crypto
Updated Branches:
  refs/heads/master a3128504c -> 5119f8411


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/master
Commit: 5119f8411967624382804dd96ebfb2e87d7fba96
Parents: a312850
Author: ggregory <gg...@apache.org>
Authored: Fri Jul 8 09:16:38 2016 -0700
Committer: ggregory <gg...@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");
         }
     }