From 72cf248dced4e272e69a8c48f5ee24c9d345f41d Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Tue, 25 Aug 2020 17:05:37 -0400 Subject: Address more sonars in drools-pdp Addressed the following sonars: - either log or rethrow - call "remove()" for thread-local-storage - use assertEquals - only one method call in exception test - swap arguments in assertEquals - add assertion to assertThatThrownBy() - explain @Ignore Also addressed eclipse warnings: - unused fields and methods Issue-ID: POLICY-2616 Change-Id: I6590c0d2b103885bc933014d48bf5fd92401cd80 Signed-off-by: Jim Hahn --- .../main/java/org/onap/policy/drools/core/PolicySession.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'policy-core/src/main/java') diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java b/policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java index 49ff7bb8..389d5b37 100644 --- a/policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java +++ b/policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java @@ -189,6 +189,16 @@ public class PolicySession policySess.set(this); } + /** + * Unset this 'PolicySession' instance as the one associated with the + * currently-running thread. + */ + public void removePolicySession() { + if (policySess.get() == this) { + policySess.remove(); + } + } + /** * Get current session. * @@ -498,6 +508,8 @@ public class PolicySession logger.error("startThread error in kieSession1.fireUntilHalt", e); } } + + session.removePolicySession(); logger.info("fireUntilHalt() returned"); } } -- cgit 1.2.3-korg