Major Sonar fixes 40/91140/2
authorr.bogacki <r.bogacki@samsung.com>
Wed, 10 Jul 2019 09:09:31 +0000 (11:09 +0200)
committerRobert Bogacki <r.bogacki@samsung.com>
Fri, 12 Jul 2019 06:49:00 +0000 (06:49 +0000)
Major Sonar fixes in different classes:
-Removed unused variables.
-Simplified diamond operators.
-Removed unnecessary imports.
-Removed unnecessary code.

Issue-ID: SO-2102
Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
Change-Id: Ib54fbe048700a4e31042481f0a9b13838552aee7

bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java
bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java

index 633736a..11b717c 100644 (file)
@@ -29,7 +29,7 @@ public class RollbackData implements Serializable {
     private static final long serialVersionUID = -4811571658272937718L;
 
     private String requestId;
-    private Map<String, String> additionalData = new HashMap<String, String>();
+    private Map<String, String> additionalData = new HashMap<>();
 
 
     public String getRequestId() {
index 4e9e9fd..d33e7ae 100644 (file)
@@ -45,8 +45,7 @@ public class WorkflowProcessor extends ProcessEngineAwareService {
     @Async
     public void startProcess(String processKey, VariableMapImpl variableMap) {
 
-        long startTime = System.currentTimeMillis();
-        Map<String, Object> inputVariables = null;
+        Map<String, Object> inputVariables;
         String processInstanceId = null;
         try {
             inputVariables = getInputVariables(variableMap);
index 6572bea..a049f81 100644 (file)
@@ -52,8 +52,6 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
 @Configuration
 public class CXFConfiguration {
 
-    private static final Logger logger = LoggerFactory.getLogger(CXFConfiguration.class);
-
     @Autowired
     private Bus bus;
 
index ad388fe..c7c12bf 100644 (file)
@@ -37,7 +37,7 @@ public class NsParameters {
 
     private List<LocationConstraint> locationConstraints;
 
-    private Map<String, Object> additionalParamForNs = new HashMap<String, Object>();
+    private Map<String, Object> additionalParamForNs = new HashMap<>();
 
     /**
      * @return Returns the locationConstraints.
index 12aade7..1add5e6 100644 (file)
@@ -35,7 +35,6 @@ import org.springframework.stereotype.Component;
 
 @Component
 public class AAIFlagTasks {
-    private static final Logger logger = LoggerFactory.getLogger(AAIFlagTasks.class);
 
     @Autowired
     private AAIVnfResources aaiVnfResources;
index 20e8fed..e9cd303 100644 (file)
@@ -88,9 +88,9 @@ public class CloudResourcesOrchestration {
     public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId,
             @PathParam("version") String version) throws ApiException {
         TenantIsolationRequest msoRequest = new TenantIsolationRequest(requestId);
-        InfraActiveRequests infraActiveRequest = null;
+        InfraActiveRequests infraActiveRequest;
 
-        CloudOrchestrationRequest cor = null;
+        CloudOrchestrationRequest cor;
 
         logger.debug("requestId is: {}", requestId);
 
@@ -140,8 +140,8 @@ public class CloudResourcesOrchestration {
 
         } else {
             String status = infraActiveRequest.getRequestStatus();
-            if (status.equalsIgnoreCase("IN_PROGRESS") || status.equalsIgnoreCase("PENDING")
-                    || status.equalsIgnoreCase("PENDING_MANUAL_TASK")) {
+            if ("IN_PROGRESS".equalsIgnoreCase(status) || "PENDING".equalsIgnoreCase(status)
+                    || "PENDING_MANUAL_TASK".equalsIgnoreCase(status)) {
                 infraActiveRequest.setRequestStatus("UNLOCKED");
                 infraActiveRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
                 infraActiveRequest.setRequestId(requestId);
@@ -181,8 +181,7 @@ public class CloudResourcesOrchestration {
             String requestId = requestIdKey.get(0);
 
             CloudOrchestrationResponse cloudOrchestrationGetResponse = new CloudOrchestrationResponse();
-            TenantIsolationRequest tenantIsolationRequest = new TenantIsolationRequest(requestId);
-            InfraActiveRequests requestDB = null;
+            InfraActiveRequests requestDB;
 
             try {
                 requestDB = requestDbClient.getInfraActiveRequestbyRequestId(requestId);
@@ -213,8 +212,8 @@ public class CloudResourcesOrchestration {
 
         } else {
             TenantIsolationRequest tenantIsolationRequest = new TenantIsolationRequest();
-            List<InfraActiveRequests> activeRequests = null;
-            CloudOrchestrationRequestList orchestrationList = null;
+            List<InfraActiveRequests> activeRequests;
+            CloudOrchestrationRequestList orchestrationList;
 
 
             Map<String, String> orchestrationMap;
@@ -233,7 +232,7 @@ public class CloudResourcesOrchestration {
             }
             activeRequests = requestDbClient.getCloudOrchestrationFiltersFromInfraActive(orchestrationMap);
             orchestrationList = new CloudOrchestrationRequestList();
-            List<CloudOrchestrationResponse> requestLists = new ArrayList<CloudOrchestrationResponse>();
+            List<CloudOrchestrationResponse> requestLists = new ArrayList<>();
 
             for (InfraActiveRequests infraActive : activeRequests) {