diff options
author | Taka Cho <takamune.cho@att.com> | 2020-06-26 11:35:12 -0400 |
---|---|---|
committer | Taka Cho <takamune.cho@att.com> | 2020-06-26 14:01:51 -0400 |
commit | 4f250eadf1bb2b7bfe736aa6511bb3df1ffe3eec (patch) | |
tree | b6a394ec0edb908a014f57304f464a5202b51fae | |
parent | 069dbb206cedae6c664972cfb8baf036989d61a0 (diff) |
m2 sonar fix
- "get" returns a string already
- to avoid sonar issue for duplicated strings
- formating
Issue-ID: POLICY-2616
Change-Id: I1fac65bba5ecb402c784dd585ebcd7992cf31545
Signed-off-by: Taka Cho <takamune.cho@att.com>
-rw-r--r-- | controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmOperation.java | 18 |
1 files changed, 8 insertions, 10 deletions
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 24f8ed5ab..cbd7413f9 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 @@ -71,6 +71,8 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria private static final long serialVersionUID = 5062964240000304989L; + private static final String DCAE_ONSET_MISSING = "dcae onset is missing "; + // state when waiting for a lock public static final String LCM_WAIT_FOR_LOCK = "LCM.WAIT_FOR_LOCK"; @@ -171,7 +173,7 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria // attempt to get a lock for the VM -- if we get it immediately, // we can go to the 'LCM_GUARD_PENDING' or 'LCM_BEGIN' state - target = this.onset.getAai().get(onset.getTarget()).toString(); + target = this.onset.getAai().get(onset.getTarget()); String key = onset.getTargetType() + ":" + target; if (transaction.getAdjunct(LockAdjunct.class).getLock(this, key, transaction.getRequestId().toString(), false)) { @@ -336,28 +338,27 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria */ private Map<String, String> setCommonPayload(Map<String, String> aai) throws ControlLoopException { Map<String, String> payload = new HashMap<>(); - for (Map.Entry<String, String> entry : aai.entrySet()) { switch (entry.getKey()) { case DCAE_VSERVER_SELF_LINK_FIELD: if (entry.getValue() != null) { payload.put(APPC_LCM_VM_ID_FIELD, entry.getValue()); } else { - setErrorStatus("dcae onset is missing " + DCAE_VSERVER_SELF_LINK_FIELD); + setErrorStatus(DCAE_ONSET_MISSING + DCAE_VSERVER_SELF_LINK_FIELD); } break; case DCAE_IDENTITY_FIELD: if (entry.getValue() != null) { payload.put(APPC_LCM_IDENTITY_URL_FIELD, entry.getValue()); } else { - setErrorStatus("dcae onset is missing " + DCAE_IDENTITY_FIELD); + setErrorStatus(DCAE_ONSET_MISSING + DCAE_IDENTITY_FIELD); } break; case DCAE_TENANT_ID_FIELD: if (entry.getValue() != null) { payload.put(APPC_LCM_TENANT_ID_FIELD, entry.getValue()); } else { - setErrorStatus("dcae onset is missing " + DCAE_TENANT_ID_FIELD); + setErrorStatus(DCAE_ONSET_MISSING + DCAE_TENANT_ID_FIELD); } break; default: @@ -646,11 +647,8 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria * @param result the value to store in the 'result' field */ void completeOperation(int attempt, String message, PolicyResult result) { - logger.debug("LCM: completeOperation(" - + "this.attempt=" + this.attempt - + ", attempt=" + attempt - + ", result=" + result - + ", message=" + message); + logger.debug("LCM: completeOperation(this.attempt={}, attempt={}, result={}, message ={})", + this.attempt, attempt, result, message); if (this.attempt == attempt) { // we need to verify that the attempt matches in order to reduce the // chances that we are reacting to a prior 'Response' message that |