diff options
author | Taka Cho <takamune.cho@att.com> | 2020-06-10 10:48:42 -0400 |
---|---|---|
committer | Taka Cho <takamune.cho@att.com> | 2020-06-10 16:17:36 -0400 |
commit | ad08d0685db264df653166fa784e8005e9d62619 (patch) | |
tree | 37c80850fe13b8316eb093bd2974b5c74b148f0e /controlloop/m2/appclcm/src | |
parent | dcc7cac5f17dacf9a58b18b518574391cdc73925 (diff) |
sonar issue drools applications - 3
get already returns string
redudant return block
unused import
swap expected argument
use equals method instead
useless assignment for payload
Issue-ID: POLICY-2616
Change-Id: Ie4f07085994420b7ea3f39db89f980f6594f01b7
Signed-off-by: Taka Cho <takamune.cho@att.com>
Diffstat (limited to 'controlloop/m2/appclcm/src')
2 files changed, 3 insertions, 8 deletions
diff --git a/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmHealthCheckOperation.java b/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmHealthCheckOperation.java index 42e06f98f..cc0df4580 100644 --- a/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmHealthCheckOperation.java +++ b/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmHealthCheckOperation.java @@ -28,7 +28,6 @@ import org.onap.policy.appclcm.AppcLcmOutput; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.controlloop.ControlLoopEvent; import org.onap.policy.controlloop.ControlLoopException; -import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.policy.Policy; import org.onap.policy.controlloop.policy.PolicyResult; import org.onap.policy.guard.PolicyGuardResponse; @@ -88,7 +87,6 @@ public class AppcLcmHealthCheckOperation extends AppcLcmOperation { if (!(object instanceof AppcLcmDmaapWrapper)) { if (object instanceof PolicyGuardResponse) { incomingGuardMessage((PolicyGuardResponse) object); - return; } // ignore this message (not sure why we even got it) return; diff --git a/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmOperation.java b/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmOperation.java index 6a2518f46..668860eb1 100644 --- a/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmOperation.java +++ b/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmOperation.java @@ -245,7 +245,7 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria * the lock, but it has now became available. */ public void lockAvailable() { - if (this.state == LCM_WAIT_FOR_LOCK) { + if (LCM_WAIT_FOR_LOCK.equals(this.state)) { // we have the lock -- invoke 'quardQuery()', // go to the appropriate state, and mark the transaction as modified guardQuery(); @@ -265,7 +265,7 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria * obtained. */ public void lockUnavailable() { - if (this.state == LCM_WAIT_FOR_LOCK) { + if (LCM_WAIT_FOR_LOCK.equals(this.state)) { try { setErrorStatus("Already processing event with this target"); } catch (ControlLoopException e) { @@ -314,7 +314,6 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria payload = setRebootPayload(); break; default: - payload = null; break; } @@ -485,7 +484,7 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria void incomingGuardMessage(PolicyGuardResponse response) { // this message is only meaningful if we are waiting for a // 'guard' response -- ignore it, if this isn't the case - if (this.state == LCM_GUARD_PENDING) { + if (LCM_GUARD_PENDING.equals(this.state)) { if ("Deny".equals(response.getResult())) { // this is a guard failure logger.error("LCM operation denied by 'Guard'"); @@ -510,10 +509,8 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria if (! (object instanceof AppcLcmDmaapWrapper)) { if (object instanceof PolicyGuardResponse) { incomingGuardMessage((PolicyGuardResponse)object); - return; } else if (object instanceof ControlLoopEvent) { incomingAbatedEvent((ControlLoopEvent) object); - return; } // ignore this message (not sure why we even got it) return; |