From 23390e1a8ac5705ccd6853b0bc80d3a04707a3d9 Mon Sep 17 00:00:00 2001 From: shashikanth Date: Tue, 26 Sep 2017 15:36:17 +0530 Subject: Fix major sonar issues Fix major sonar issues in policy/drools-applications module https://sonar.onap.org/component_issues?id=org.onap.policy.drools-applications%3Adrools-pdp-apps#resolved=false|severities=MAJOR|rules=squid%3AS1132 Fixed string literal comparison for for SO and VF Module Create and few optimizations. Issue-Id:POLICY-239 Change-Id: I8e228463ebc7f3114e5caba9b423552bb84dd52d Signed-off-by: shashikanth.vh --- .../controlloop/actor/so/SOActorServiceProvider.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'controlloop') diff --git a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java index a014c7a80..8c1b23af9 100644 --- a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java +++ b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java @@ -136,10 +136,10 @@ public class SOActorServiceProvider implements Actor { } - /** + /** * Constructs and sends an AAI vserver Named Query * - * @param eventRequestID + * @param onset * @returns the response to the AAI Named Query */ private AAINQResponseWrapper AaiNamedQueryRequest(VirtualControlLoopEvent onset) { @@ -239,9 +239,9 @@ public class SOActorServiceProvider implements Actor { int nonBaseIndex = -1; List inventoryItems = namedQueryResponseWrapper.aainqresponse.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems; for (AAINQInventoryResponseItem m : inventoryItems) { - if (m.vfModule != null && m.vfModule.isBaseVfModule == true) { + if (m.vfModule != null && m.vfModule.isBaseVfModule) { baseIndex = inventoryItems.indexOf(m); - } else if (m.vfModule != null && m.vfModule.isBaseVfModule == false && m.vfModule.orchestrationStatus == null) { + } else if (m.vfModule != null && m.vfModule.orchestrationStatus == null) { nonBaseIndex = inventoryItems.indexOf(m); } // @@ -302,7 +302,7 @@ public class SOActorServiceProvider implements Actor { } // Extracted fields should not be null - if (checkExtractedFields() == false) { + if (!checkExtractedFields()) { System.err.println("some fields are missing from AAI response."); return; } @@ -338,7 +338,7 @@ public class SOActorServiceProvider implements Actor { */ public SORequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, Policy policy) { - if (policy.getActor().equals("SO") && policy.getRecipe().equals("VF Module Create")) { + if ("SO".equals(policy.getActor()) && "VF Module Create".equals(policy.getRecipe())) { // perform named query request and handle response AaiNamedQueryRequest(onset); } else { @@ -348,7 +348,7 @@ public class SOActorServiceProvider implements Actor { // check if the fields extracted from named query response are // not null so we can proceed with SO request - if (checkExtractedFields() == false) { + if (!checkExtractedFields()) { System.err.println("AAI response is missing some required fields. Cannot proceed with SO Request construction."); return null; @@ -553,7 +553,7 @@ public class SOActorServiceProvider implements Actor { } /** - * @param serviceItemModeInvariantlId the serviceItemModelInvariantId to set + * @param serviceItemModelInvariantId the serviceItemModelInvariantId to set */ private void setServiceItemModelInvariantId(String serviceItemModelInvariantId) { this.serviceItemModelInvariantId = serviceItemModelInvariantId; -- cgit 1.2.3-korg