You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2015/04/21 16:20:47 UTC

[5/5] cxf git commit: Avoid NPE if the keystore does not contain the given alias

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/8c8ed166
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/8c8ed166
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/8c8ed166

Branch: refs/heads/master
Commit: 8c8ed16605a2d7468da380155e9aa4c4bbd62031
Parents: e4feffb
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Tue Apr 21 14:48:50 2015 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Tue Apr 21 15:20:29 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/8c8ed166/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 1b732e5..5495fbc 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
@@ -637,6 +637,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);