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/c7ee8a22 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/c7ee8a22 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/c7ee8a22 Branch: refs/heads/1.2.x-fixes Commit: c7ee8a223f1e4a40cac1a1b20b1cca2adeeb240b Parents: f00f2b3 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:59:42 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/c7ee8a22/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 0d3981f..c6f9c25 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 { if (keyAlias == null || "".equals(keyAlias)) { 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);
