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 --- .../java/org/onap/policy/drools/system/Main.java | 24 ++++++++-------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'policy-management/src/main/java/org/onap') diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/Main.java b/policy-management/src/main/java/org/onap/policy/drools/system/Main.java index 4f0dc39c..9e6d0432 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/Main.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/Main.java @@ -157,10 +157,8 @@ public class Main { .flush(); logger.warn( LoggerUtil.TRANSACTION_LOG_MARKER, - "Main: cannot start {} (bad state) because of {}", - PolicyEngineConstants.getManager(), - e.getMessage(), - e); + "Main: cannot start {} (bad state)", + PolicyEngineConstants.getManager()); throw new PolicyDroolsPdpRuntimeException( String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_DROOLS_PDP), e); } catch (final Exception e) { @@ -171,10 +169,8 @@ public class Main { .flush(); logger.warn( LoggerUtil.TRANSACTION_LOG_MARKER, - "Main: cannot start {} because of {}", - PolicyEngineConstants.getManager(), - e.getMessage(), - e); + "Main: cannot start {}", + PolicyEngineConstants.getManager()); throw new PolicyDroolsPdpRuntimeException( String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_DROOLS_PDP), e); } @@ -209,10 +205,8 @@ public class Main { .flush(); logger.error( LoggerUtil.TRANSACTION_LOG_MARKER, - "Main: cannot instantiate policy-controller {} because of {}", - controllerName, - e.getMessage(), - e); + "Main: cannot instantiate policy-controller {}", + controllerName); throw new PolicyDroolsPdpRuntimeException( String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_DROOLS_PDP), e); } catch (final LinkageError e) { @@ -223,10 +217,8 @@ public class Main { .flush(); logger.warn( LoggerUtil.TRANSACTION_LOG_MARKER, - "Main: cannot instantiate policy-controller {} (linkage) because of {}", - controllerName, - e.getMessage(), - e); + "Main: cannot instantiate policy-controller {} (linkage)", + controllerName); throw new PolicyDroolsPdpRuntimeException( String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_DROOLS_PDP), e); } -- cgit 1.2.3-korg