From b0980a0e0fc69ff9f1faff0153e1bd0c5ccc3b98 Mon Sep 17 00:00:00 2001 From: tlenz Date: Wed, 1 Mar 2017 13:35:23 +0100 Subject: fix possible nullpointer exception if trustprofile needs TSL support but the TSL client is not initialized --- .../egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'moaSig/moa-sig-lib/src/main/java') diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java index b776255..f79cf7a 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/pki/PKIProfileImpl.java @@ -31,6 +31,7 @@ import iaik.pki.store.truststore.TrustStoreTypes; import java.util.Arrays; +import at.gv.egovernment.moa.sig.tsl.api.ITslService; import at.gv.egovernment.moa.sig.tsl.exception.TslPKIException; import at.gv.egovernment.moa.sig.tsl.pki.TslTrustStoreProfile; import at.gv.egovernment.moa.sig.tsl.pki.chaining.ChainingTrustStoreProfile; @@ -95,9 +96,16 @@ public class PKIProfileImpl implements PKIProfile { if (tp.isTSLEnabled()) { - //build TSL truststore if enabled TslTrustStoreProfile tslTrustStore; try { + if (!TSLServiceFactory.isInitialized()) { + Logger.error("Can not build TrustProfile:" + trustProfileId + + " Reason: TrustProfile needs TSL support but TSL client NOT initialized."); + throw new TslPKIException("Trust Status-List service client is NOT initialized"); + + } + + //build TSL truststore if enabled tslTrustStore = TSLServiceFactory.getTSLServiceClient(). buildTrustStoreProfile( tp.getCountries(), -- cgit v1.2.3