commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject commons-crypto git commit: Correct Javadoc; detect missing classname(s)
Date Mon, 27 Jun 2016 22:07:24 GMT
Repository: commons-crypto
Updated Branches:
  refs/heads/master cc6233f20 -> 5b78fca11


Correct Javadoc; detect missing classname(s)

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

Branch: refs/heads/master
Commit: 5b78fca1190ed6fc13d6b9d683245c9a48e8b780
Parents: cc6233f
Author: Sebb <sebb@apache.org>
Authored: Mon Jun 27 23:07:19 2016 +0100
Committer: Sebb <sebb@apache.org>
Committed: Mon Jun 27 23:07:19 2016 +0100

----------------------------------------------------------------------
 .../org/apache/commons/crypto/cipher/CryptoCipherFactory.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/5b78fca1/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 8ab761c..7285c45 100644
--- a/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java
+++ b/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java
@@ -47,9 +47,9 @@ public class CryptoCipherFactory {
      * @param props  the configuration properties 
      *      (uses ConfigurationKeys.ENABLE_FALLBACK_ON_NATIVE_FAILED_KEY and ConfigurationKeys.CIPHER_CLASSES_KEY)
      * @param transformation  algorithm/mode/padding
-     * @return CryptoCipher the cipher. Null value will be returned if no cipher
-     *         classes with transformation configured.
+     * @return CryptoCipher the cipher
      * @throws GeneralSecurityException if cipher initialize failed
+     * @throws IllegalArgumentException if no classname(s) are provided and fallback is disabled
      */
     public static CryptoCipher getInstance(String transformation,
             Properties props) throws GeneralSecurityException {
@@ -75,6 +75,9 @@ public class CryptoCipherFactory {
         } else if (Utils.isFallbackEnabled(props)) {
             return new JceCipher(props,transformation);
         } else {
+            if (errorMessage.length() == 0) {
+                throw new IllegalArgumentException("No classname(s) provided, and fallback
is not enabled");
+            }
             errorMessage.append(" is not available or transformation " +
                     transformation + " is not supported.");
             throw new GeneralSecurityException(errorMessage.toString());


Mime
View raw message