summaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-09-30 12:52:25 -0400
committerJim Hahn <jrh3@att.com>2020-09-30 14:59:39 -0400
commitfb9bd637567096f6174bbc2e52a5e149a4eed882 (patch)
tree7b0d2df1aefbb3635788af501be1157fbe05d798 /controlloop/common/eventmanager/src
parente8e477ab80c6762fb05aebfe9becc630d2d51e39 (diff)
Fix new sonars in drools-apps
Addressed the following sonars: - too many assertions in test method - rename test class - use static method to modify static field - use already defined constant - code always returns the same value - use assertNotSame - use appropriate class name to access static method - define a constant - extract nested try block - don't always return the same value - use remove() instead of set(null) for thread-local-storage - add @Override Issue-ID: POLICY-2852 Change-Id: Icc62acd4ad57afa2d44ed4cdca504a3ac0810228 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/eventmanager/src')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Drools.java2
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java7
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/Step.java7
3 files changed, 14 insertions, 2 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Drools.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Drools.java
index 3af9defc7..9e8af9afb 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Drools.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Drools.java
@@ -33,6 +33,8 @@ import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
* {@link #isActive()} returns {@code false}, indicating that all steps have completed.
*/
public class ControlLoopEventManager2Drools extends ControlLoopEventManager2 {
+ private static final long serialVersionUID = 1L;
+
private final transient WorkingMemory workMem;
private transient FactHandle factHandle;
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
index 31402f4cf..62d4fc8c0 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
@@ -300,7 +300,12 @@ public class ControlLoopOperationManager2 implements Serializable {
* @param thrown exception that was generated
* @return {@code null}
*/
- private OperationOutcome handleException(Throwable thrown) {
+ private OperationOutcome handleException(Throwable thrown) { // NOSONAR
+ /*
+ * disabling sonar about returning the same value because we prefer the code to be
+ * structured this way
+ */
+
if (thrown instanceof CancellationException || thrown.getCause() instanceof CancellationException) {
return null;
}
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/Step.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/Step.java
index ae51c737f..1cbdb53b2 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/Step.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/Step.java
@@ -178,7 +178,12 @@ public class Step {
* @param thrown exception that was generated
* @return {@code null}
*/
- private OperationOutcome handleException(Throwable thrown) {
+ private OperationOutcome handleException(Throwable thrown) { // NOSONAR
+ /*
+ * disabling sonar about returning the same value because we prefer the code to be
+ * structured this way
+ */
+
if (thrown instanceof CancellationException || thrown.getCause() instanceof CancellationException) {
return null;
}