diff options
author | 2020-06-17 10:45:59 -0400 | |
---|---|---|
committer | 2020-06-17 12:35:04 -0400 | |
commit | 6cec2b32fdd2a9976a8c6e9488608fc84664f16f (patch) | |
tree | 65669641a3fc7e9ee2752b87e13ed591b4702fab /controlloop/m2/guard/src/main | |
parent | eb1d814c4e6a83222bc9a61f5f5e15d0ad85a492 (diff) |
m2 sonar issues
- unused import
- logger format
- Extract the assignment out of this expression
- Replace this if-then-else statement
by a single return statement
Issue-ID: POLICY-2616
Change-Id: I2d04569a7070f79fc8979274bce2b87b4b2f3e24
Signed-off-by: Taka Cho <takamune.cho@att.com>
Diffstat (limited to 'controlloop/m2/guard/src/main')
-rw-r--r-- | controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java b/controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java index a0d159150..1bfb6ae4c 100644 --- a/controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java +++ b/controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java @@ -27,19 +27,15 @@ import java.time.Instant; import java.util.HashMap; import java.util.Properties; import java.util.UUID; -import java.util.function.Supplier; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import org.drools.core.WorkingMemory; -import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.core.PolicyContainer; import org.onap.policy.drools.core.PolicySession; import org.onap.policy.drools.system.PolicyController; import org.onap.policy.drools.system.PolicyControllerConstants; import org.onap.policy.drools.system.PolicyEngineConstants; -import org.onap.policy.guard.OperationsHistory; -import org.onap.policy.guard.Util; import org.onap.policy.util.DroolsSessionCommonSerializable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -177,7 +173,7 @@ public class GuardContext implements Serializable { sb.setLength(sb.length() - 2); errorMessage = sb.toString(); disabled = true; - logger.error("Initialization failure: " + errorMessage); + logger.error("Initialization failure: {}", errorMessage); } } @@ -301,7 +297,7 @@ public class GuardContext implements Serializable { if (disabled) { if (errorMessage != null) { - logger.error("Database update skipped: " + errorMessage); + logger.error("Database update skipped: {}", errorMessage); } return false; } @@ -366,7 +362,7 @@ public class GuardContext implements Serializable { final String message, final String outcome) { if (disabled) { if (errorMessage != null) { - logger.error("Database update skipped: " + errorMessage); + logger.error("Database update skipped: {}", errorMessage); } return; } |