Repository: commons-crypto Updated Branches: refs/heads/master aaae85c8a -> edbdf9185
CRYPTO-108 OpenSSL does not handle Native code loading failure Don't construct class if it won't work Project: http://git-wip-us.apache.org/repos/asf/commons-crypto/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-crypto/commit/edbdf918 Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/edbdf918 Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/edbdf918 Branch: refs/heads/master Commit: edbdf9185f45ce218c5b4b6ba18324d14aa8485d Parents: aaae85c Author: Sebb <[email protected]> Authored: Wed Jul 6 23:56:16 2016 +0100 Committer: Sebb <[email protected]> Committed: Wed Jul 6 23:56:16 2016 +0100 ---------------------------------------------------------------------- src/main/java/org/apache/commons/crypto/cipher/OpenSsl.java | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/edbdf918/src/main/java/org/apache/commons/crypto/cipher/OpenSsl.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/cipher/OpenSsl.java b/src/main/java/org/apache/commons/crypto/cipher/OpenSsl.java index ad66572..64487d4 100644 --- a/src/main/java/org/apache/commons/crypto/cipher/OpenSsl.java +++ b/src/main/java/org/apache/commons/crypto/cipher/OpenSsl.java @@ -137,9 +137,13 @@ final class OpenSsl { * specified algorithm. * @throws NoSuchPaddingException if <code>transformation</code> contains a * padding scheme that is not available. + * @throws IllegalStateException if native code cannot be initialised */ public static OpenSsl getInstance(String transformation) throws NoSuchAlgorithmException, NoSuchPaddingException { + if (loadingFailureReason != null) { + throw new IllegalStateException(loadingFailureReason); + } Transform transform = tokenizeTransformation(transformation); int algorithmMode = AlgorithmMode.get(transform.algorithm, transform.mode);
