Fixed blockers according to Sonar analysis.
Change-Id: Ib068b586cd72c1634780220ac5498e1962dee434
Issue-ID: SO-1734
Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
             StackInfo stackStatus = getStackStatus(cloudSiteId, cloudOwner, tenantId, canonicalName, pollForCompletion, timeoutMinutes, backout);
 
             if (HeatStatus.CREATED.equals(stackStatus.getStatus())) {
-                multicloudAaiUpdate(cloudSiteId, cloudOwner, tenantId, genericVnfId, vfModuleId, multicloudResponseBody.getWorkloadId(), pollForCompletion, timeoutMinutes);
+                String workloadId = multicloudResponseBody == null ? null : multicloudResponseBody.getWorkloadId();
+                multicloudAaiUpdate(cloudSiteId, cloudOwner, tenantId, genericVnfId, vfModuleId, workloadId, pollForCompletion, timeoutMinutes);
             }
 
             return stackStatus;
         if (multicloudClient == null) {
             if (logger.isDebugEnabled())
                 logger.debug("Multicloud client could not be initialized");
+            return;
         }
 
         Response response = multicloudClient.post(multicloudRequest);
 
             ExecutionServiceInput executionServiceInput = (ExecutionServiceInput) execution
                     .getVariable("executionServiceInput");
 
-            //CDSProcessingListener cdsProcessingListener = new AbstractCDSProcessingBBUtils();
-
-            CDSProcessingClient cdsClient = null;
-            CountDownLatch countDownLatch;
-            try {
-                cdsClient = new CDSProcessingClient(this);
-                countDownLatch = cdsClient.sendRequest(executionServiceInput);
+            try(CDSProcessingClient cdsClient = new CDSProcessingClient(this)) {
+                CountDownLatch countDownLatch = cdsClient.sendRequest(executionServiceInput);
                 countDownLatch.await(props.getTimeout(), TimeUnit.SECONDS);
-            } catch (InterruptedException ex) {
+            } catch (InterruptedException ex){
                 logger.error("Caught exception in sendRequestToCDSClient in AbstractCDSProcessingBBUtils : ", ex);
                 Thread.currentThread().interrupt();
-            } finally {
-                cdsClient.close();
             }
 
             if (cdsResponse != null) {
 
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Ericsson. All rights reserved.
  * ================================================================================
+ *  Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
           + (deleteVnfResponse != null ? deleteVnfResponse.getJobId() : "null") + "Unable to retrieve OperationStatus";
       LOGGER.error(message);
       exceptionUtil.buildAndThrowWorkflowException(execution, 1214, message);
-    }
-    if (operationStatusOption.isPresent()) {
+    } else if (operationStatusOption != null && operationStatusOption.isPresent()) {
       final OperationStateEnum operationStatus = operationStatusOption.get();
       if (operationStatus != OperationStateEnum.COMPLETED) {
         final String message =