From 89bf2e721cd43c0acce52e0e6ea509d134be288e Mon Sep 17 00:00:00 2001 From: "abhishek.c92" Date: Fri, 15 Jul 2022 11:20:27 +0530 Subject: CCSDK-3721: Fix sonar issues for AAIClientRESTExecutor Add null check for KeyManagerFactory instance Issue-ID: CCSDK-3721 Signed-off-by: abhishek.c92 Change-Id: I783fa1447e2ed1e8655a0364899647d04de565f8 --- .../java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java index d3f79db8d..3ededcc54 100755 --- a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java +++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java @@ -52,6 +52,7 @@ import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocketFactory; import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang3.ObjectUtils; import org.onap.ccsdk.sli.adaptors.aai.AAIService.TransactionIdTracker; import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; import org.onap.ccsdk.sli.adaptors.aai.data.ErrorResponse; @@ -160,8 +161,9 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface { } catch (Exception ex) { LOG.error("AAIResource", ex); } - - ctx.init(kmf.getKeyManagers(), null, null); + if (ObjectUtils.anyNotNull(kmf)) { + ctx.init(kmf.getKeyManagers(), null, null); + } CTX = ctx; LOG.debug("SSLContext created"); -- cgit 1.2.3-korg