cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [2/5] cxf git commit: Avoid NPE if the keystore does not contain the given alias
Date Tue, 21 Apr 2015 15:06:50 GMT
Avoid NPE if the keystore does not contain the given alias


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/948502d1
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/948502d1
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/948502d1

Branch: refs/heads/3.0.x-fixes
Commit: 948502d11fcc1514e3c7237d51eb8a88ce6f2d70
Parents: a0d3b61
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Tue Apr 21 14:48:50 2015 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Tue Apr 21 15:54:01 2015 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/cxf/common/util/crypto/CryptoUtils.java  | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/948502d1/core/src/main/java/org/apache/cxf/common/util/crypto/CryptoUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/util/crypto/CryptoUtils.java b/core/src/main/java/org/apache/cxf/common/util/crypto/CryptoUtils.java
index 55ab006..ce9bc18 100644
--- a/core/src/main/java/org/apache/cxf/common/util/crypto/CryptoUtils.java
+++ b/core/src/main/java/org/apache/cxf/common/util/crypto/CryptoUtils.java
@@ -653,6 +653,9 @@ public final class CryptoUtils {
     }
     public static Certificate loadCertificate(KeyStore keyStore, String alias) {
         try {
+            if (!keyStore.containsAlias(alias)) {
+                throw new SecurityException("No alias exists in the keystore for the given
alias: " + alias);
+            }
             return keyStore.getCertificate(alias);
         } catch (Exception ex) { 
             throw new SecurityException(ex);


Mime
View raw message