Fixing NPE if no key alias
Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/1a26bcf4 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/1a26bcf4 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/1a26bcf4 Branch: refs/heads/master Commit: 1a26bcf4f0b34f10c23d0ca46b9bec72a4a956df Parents: d280bce Author: Colm O hEigeartaigh <[email protected]> Authored: Wed Jul 20 11:56:13 2016 +0100 Committer: Colm O hEigeartaigh <[email protected]> Committed: Wed Jul 20 11:56:13 2016 +0100 ---------------------------------------------------------------------- .../src/main/java/org/apache/cxf/fediz/core/util/CertsUtils.java | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/1a26bcf4/plugins/core/src/main/java/org/apache/cxf/fediz/core/util/CertsUtils.java ---------------------------------------------------------------------- diff --git a/plugins/core/src/main/java/org/apache/cxf/fediz/core/util/CertsUtils.java b/plugins/core/src/main/java/org/apache/cxf/fediz/core/util/CertsUtils.java index a1e2848..24d6be1 100644 --- a/plugins/core/src/main/java/org/apache/cxf/fediz/core/util/CertsUtils.java +++ b/plugins/core/src/main/java/org/apache/cxf/fediz/core/util/CertsUtils.java @@ -110,6 +110,10 @@ public final class CertsUtils { keyAlias = crypto.getDefaultX509Identifier(); } + if (keyAlias == null) { + throw new RuntimeException("No keystore alias was specified to sign the metadata"); + } + CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS); cryptoType.setAlias(keyAlias); X509Certificate[] issuerCerts = crypto.getX509Certificates(cryptoType);
