CCSDK-3721: Fix sonar issues for AAIClientRESTExecutor 84/129984/1
authorabhishek.c92 <abhishek.c92@samsung.com>
Fri, 15 Jul 2022 05:50:27 +0000 (11:20 +0530)
committerabhishek.c92 <abhishek.c92@samsung.com>
Fri, 15 Jul 2022 05:54:59 +0000 (11:24 +0530)
Add null check for KeyManagerFactory instance

Issue-ID: CCSDK-3721
Signed-off-by: abhishek.c92 <abhishek.c92@samsung.com>
Change-Id: I783fa1447e2ed1e8655a0364899647d04de565f8

adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java

index d3f79db..3ededcc 100755 (executable)
@@ -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");