diff options
author | Fraser Tweedale <ftweedal@redhat.com> | 2017-05-25 15:32:14 +1000 |
---|---|---|
committer | Fraser Tweedale <ftweedal@redhat.com> | 2017-06-05 13:43:35 +1000 |
commit | c0b2daef934a8f5ac1c61d673865348aa2a0f702 (patch) | |
tree | 27d3bd9ed68f5081979a2843a123f21736971e08 | |
parent | 64b7b7abfed29b6a520be66414139364d713461e (diff) | |
download | pki-c0b2daef934a8f5ac1c61d673865348aa2a0f702.tar.gz pki-c0b2daef934a8f5ac1c61d673865348aa2a0f702.tar.xz pki-c0b2daef934a8f5ac1c61d673865348aa2a0f702.zip |
Improve exception message for null AuthorityKeyIdentifier
When the Authority Key Identifier extension cannot be instantiated,
we currently fail with a generic "extension not found" error
message. Throw a better exception for this case in particular, and
improve the exception message for the general case of attempting to
add a null exception.
Fixes: https://pagure.io/dogtagpki/issue/2705
Change-Id: Ic79742d8a228391275ffe5bfeef0a324f6b431bd
-rw-r--r-- | base/server/cms/src/com/netscape/cms/profile/def/AuthorityKeyIdentifierExtDefault.java | 4 | ||||
-rw-r--r-- | base/server/cms/src/com/netscape/cms/profile/def/EnrollDefault.java | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/base/server/cms/src/com/netscape/cms/profile/def/AuthorityKeyIdentifierExtDefault.java b/base/server/cms/src/com/netscape/cms/profile/def/AuthorityKeyIdentifierExtDefault.java index 42931de26..f8d8b44b1 100644 --- a/base/server/cms/src/com/netscape/cms/profile/def/AuthorityKeyIdentifierExtDefault.java +++ b/base/server/cms/src/com/netscape/cms/profile/def/AuthorityKeyIdentifierExtDefault.java @@ -183,6 +183,10 @@ public class AuthorityKeyIdentifierExtDefault extends CAEnrollDefault { } catch (EBaseException e) { throw new EProfileException(e); } + if (ext == null) { + throw new EProfileException( + "Could not instantiate AuthorityKeyIdentifier extension."); + } addExtension(PKIXExtensions.AuthorityKey_Id.toString(), ext, info); } diff --git a/base/server/cms/src/com/netscape/cms/profile/def/EnrollDefault.java b/base/server/cms/src/com/netscape/cms/profile/def/EnrollDefault.java index 1d5bfc4f8..61928882c 100644 --- a/base/server/cms/src/com/netscape/cms/profile/def/EnrollDefault.java +++ b/base/server/cms/src/com/netscape/cms/profile/def/EnrollDefault.java @@ -367,7 +367,7 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe protected void addExtension(String name, Extension ext, X509CertInfo info) throws EProfileException { if (ext == null) { - throw new EProfileException("extension not found"); + throw new EProfileException("addExtension: extension '" + name + "' is null"); } CertificateExtensions exts = null; |