Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 43AB417BBE for ; Tue, 21 Apr 2015 14:20:52 +0000 (UTC) Received: (qmail 4376 invoked by uid 500); 21 Apr 2015 14:20:44 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 4212 invoked by uid 500); 21 Apr 2015 14:20:44 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 4081 invoked by uid 99); 21 Apr 2015 14:20:43 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Apr 2015 14:20:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A54A0E0922; Tue, 21 Apr 2015 14:20:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: coheigea@apache.org To: commits@cxf.apache.org Date: Tue, 21 Apr 2015 14:20:47 -0000 Message-Id: In-Reply-To: <6984bbd4c07846da8c5142cbbb7f5155@git.apache.org> References: <6984bbd4c07846da8c5142cbbb7f5155@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Tue Apr 21 14:48:50 2015 +0100 Committer: Colm O hEigeartaigh 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);