Repository: commons-crypto Updated Branches: refs/heads/master 24e32ee97 -> d2bf64513
Simplify: split cannot return null Project: http://git-wip-us.apache.org/repos/asf/commons-crypto/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-crypto/commit/d2bf6451 Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/d2bf6451 Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/d2bf6451 Branch: refs/heads/master Commit: d2bf645131a0b0107662779ca7d0be0a7a2f958a Parents: 24e32ee Author: Sebb <s...@apache.org> Authored: Sun Jun 26 00:51:49 2016 +0100 Committer: Sebb <s...@apache.org> Committed: Sun Jun 26 00:51:49 2016 +0100 ---------------------------------------------------------------------- .../crypto/cipher/CryptoCipherFactory.java | 21 +++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/d2bf6451/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 df78f30..882ca7a 100644 --- a/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java +++ b/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java @@ -54,22 +54,19 @@ public class CryptoCipherFactory { public static CryptoCipher getInstance(String transformation, Properties props) throws GeneralSecurityException { - List<String> klasses = Utils.splitClassNames(getCipherClassString(props), ","); CryptoCipher cipher = null; StringBuilder errorMessage = new StringBuilder("CryptoCipher "); - if (klasses != null) { - for (String klass : klasses) { - try { - Class<?> cls = ReflectionUtils.getClassByName(klass); - cipher = ReflectionUtils.newInstance(cls.asSubclass - (CryptoCipher.class), props, transformation); - if (cipher != null) { - break; - } - } catch (Exception e) { - errorMessage.append("{" + klass + "}"); + for (String klass : Utils.splitClassNames(getCipherClassString(props), ",")) { + try { + Class<?> cls = ReflectionUtils.getClassByName(klass); + cipher = ReflectionUtils.newInstance(cls.asSubclass + (CryptoCipher.class), props, transformation); + if (cipher != null) { + break; } + } catch (Exception e) { + errorMessage.append("{" + klass + "}"); } }