From de0d9b69834ebb6d93a5dca26de191834eda05ba Mon Sep 17 00:00:00 2001 From: shashikanth Date: Tue, 26 Sep 2017 18:08:36 +0530 Subject: Deleted redundant code Fix major sonar issues in so module https://sonar.onap.org/component_issues?id=org.openecomp.so%3Aso#resolved=false|severities=BLOCKER%2CMAJOR|rules=squid%3AS1132%2Csquid%3AS1143 Move the "service" string literal on the left side of this string comparison. Deleted redundant variables Issue-Id: APPC-186 Change-Id: I25410825aadfaf1ff444c6fa39d2783344db70d0 Signed-off-by: shashikanth.vh --- .../mso/apihandlerinfra/E2EServiceInstances.java | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso') diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java index 0c0c3cb339..eb20f87b77 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java @@ -87,9 +87,7 @@ public class E2EServiceInstances { @ApiOperation(value="Create a E2E Service Instance on a version provided",response=Response.class) public Response createE2EServiceInstance(String request, @PathParam("version") String version) { - Response response = E2EserviceInstances(request, Action.createInstance, null, version); - - return response; + return E2EserviceInstances(request, Action.createInstance, null, version); } /** @@ -103,14 +101,13 @@ public class E2EServiceInstances { @ApiOperation(value="Delete E2E Service Instance on a specified version and serviceId",response=Response.class) public Response deleteE2EServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceId") String serviceId) { - instanceIdMap.put("serviceId", serviceId); - Response response = E2EserviceInstances(request, Action.deleteInstance, null, version); + instanceIdMap.put("serviceId", serviceId); - return response; + return E2EserviceInstances(request, Action.deleteInstance, null, version); } private Response E2EserviceInstances(String requestJSON, Action action, - HashMap instanceIdMap, String version) { + HashMap instanceIdMap, String version) { String requestId = UUIDChecker.generateUUID(msoLogger); long startTime = System.currentTimeMillis(); @@ -148,7 +145,8 @@ public class E2EServiceInstances { String requestScope = sir.getService().getParameters().getNodeType(); try { - if(!(instanceName==null && requestScope.equals("service") && (action == Action.createInstance || action == Action.activateInstance))){ + if(!(instanceName==null && "service".equals(requestScope) && (action == Action.createInstance || action + == Action.activateInstance))){ dup = (RequestsDatabase.getInstance()).checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope); } } catch (Exception e) { @@ -493,10 +491,10 @@ public class E2EServiceInstances { requestParameters.setSubscriptionServiceType("MOG"); //Userparams - List userParams = new ArrayList<>(); + List userParams; userParams = e2eSir.getService().getParameters().getRequestParameters().getUserParams(); - List> userParamList = new ArrayList>(); - Map userParamMap= new HashMap(); + List> userParamList = new ArrayList<>(); + Map userParamMap= new HashMap<>(); for(E2EUserParam userp: userParams){ userParamMap.put(userp.getName(), userp.getValue()); userParamList.add(userParamMap); -- cgit 1.2.3-korg