From c7113532f34e920d6cfe773cd84591fc863801ae Mon Sep 17 00:00:00 2001 From: "r.bogacki" Date: Wed, 10 Jul 2019 11:09:31 +0200 Subject: Major Sonar fixes 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 Change-Id: Ib54fbe048700a4e31042481f0a9b13838552aee7 --- .../java/org/onap/so/bpmn/core/domain/RollbackData.java | 2 +- .../bpmn/common/workflow/service/WorkflowProcessor.java | 3 +-- .../onap/so/bpmn/infrastructure/CXFConfiguration.java | 2 -- .../so/bpmn/infrastructure/vfcmodel/NsParameters.java | 2 +- .../so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java | 1 - .../tenantisolation/CloudResourcesOrchestration.java | 17 ++++++++--------- 6 files changed, 11 insertions(+), 16 deletions(-) diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java index 633736a25a..11b717c0d2 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java @@ -29,7 +29,7 @@ public class RollbackData implements Serializable { private static final long serialVersionUID = -4811571658272937718L; private String requestId; - private Map additionalData = new HashMap(); + private Map additionalData = new HashMap<>(); public String getRequestId() { diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java index 4e9e9fdf0e..d33e7aed0c 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java @@ -45,8 +45,7 @@ public class WorkflowProcessor extends ProcessEngineAwareService { @Async public void startProcess(String processKey, VariableMapImpl variableMap) { - long startTime = System.currentTimeMillis(); - Map inputVariables = null; + Map inputVariables; String processInstanceId = null; try { inputVariables = getInputVariables(variableMap); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java index 6572beaba9..a049f81906 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java @@ -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; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java index ad388feffc..c7c12bf4e7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java @@ -37,7 +37,7 @@ public class NsParameters { private List locationConstraints; - private Map additionalParamForNs = new HashMap(); + private Map additionalParamForNs = new HashMap<>(); /** * @return Returns the locationConstraints. diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java index 12aade71bc..1add5e6d24 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java @@ -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; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java index 20e8fed32d..e9cd303c0b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java @@ -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 activeRequests = null; - CloudOrchestrationRequestList orchestrationList = null; + List activeRequests; + CloudOrchestrationRequestList orchestrationList; Map orchestrationMap; @@ -233,7 +232,7 @@ public class CloudResourcesOrchestration { } activeRequests = requestDbClient.getCloudOrchestrationFiltersFromInfraActive(orchestrationMap); orchestrationList = new CloudOrchestrationRequestList(); - List requestLists = new ArrayList(); + List requestLists = new ArrayList<>(); for (InfraActiveRequests infraActive : activeRequests) { -- cgit 1.2.3-korg