From 56a15039437ba5bf5d0fb422551bfb12e1f59eb1 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 19 Jun 2020 14:32:10 -0400 Subject: Address checkstyle version issues in drools-pdp Also added serializationId to several classes to address eclipse warnings. Issue-ID: POLICY-2188 Change-Id: I3df5e8abaad8da9261c0d5cd19a93ed68dceb870 Signed-off-by: Jim Hahn --- .../drools/controller/internal/MavenDroolsController.java | 10 ++++------ .../onap/policy/drools/persistence/FileSystemPersistence.java | 1 - .../policy/drools/system/IndexedPolicyControllerFactory.java | 7 +++---- .../org/onap/policy/drools/system/PolicyEngineManager.java | 4 ++-- .../controller/internal/MavenDroolsControllerUpgradesTest.java | 6 +++--- 5 files changed, 12 insertions(+), 16 deletions(-) (limited to 'policy-management/src') diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java index 4e4fddf9..935cb11d 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java @@ -567,8 +567,7 @@ public class MavenDroolsController implements DroolsController { if (feature.beforeDeliver(this, sink, event)) { return true; } - } - catch (Exception e) { + } catch (Exception e) { logger.error("{}: feature {} before-deliver failure because of {}", this, feature.getClass().getName(), e.getMessage(), e); } @@ -604,8 +603,7 @@ public class MavenDroolsController implements DroolsController { if (feature.afterDeliver(this, sink, event, json, success)) { return true; } - } - catch (Exception e) { + } catch (Exception e) { logger.error("{}: feature {} after-deliver failure because of {}", this, feature.getClass().getName(), e.getMessage(), e); } @@ -748,10 +746,10 @@ public class MavenDroolsController implements DroolsController { } @Override - public Map factClassNames(String sessionName) { + public Map factClassNames(String sessionName) { validateSessionName(sessionName); - Map classNames = new HashMap<>(); + Map classNames = new HashMap<>(); PolicySession session = getSession(sessionName); KieSession kieSession = session.getKieSession(); diff --git a/policy-management/src/main/java/org/onap/policy/drools/persistence/FileSystemPersistence.java b/policy-management/src/main/java/org/onap/policy/drools/persistence/FileSystemPersistence.java index ab19a898..02a1a81b 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/persistence/FileSystemPersistence.java +++ b/policy-management/src/main/java/org/onap/policy/drools/persistence/FileSystemPersistence.java @@ -32,7 +32,6 @@ import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.Properties; - import java.util.function.BiPredicate; import org.onap.policy.drools.properties.DroolsPropertyConstants; import org.onap.policy.drools.utils.PropertyUtil; diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/IndexedPolicyControllerFactory.java b/policy-management/src/main/java/org/onap/policy/drools/system/IndexedPolicyControllerFactory.java index cb526e04..6956a45e 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/IndexedPolicyControllerFactory.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/IndexedPolicyControllerFactory.java @@ -21,7 +21,6 @@ package org.onap.policy.drools.system; import com.fasterxml.jackson.annotation.JsonIgnore; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -45,13 +44,13 @@ class IndexedPolicyControllerFactory implements PolicyControllerFactory { /** * Policy Controller Name Index. */ - private final HashMap policyControllers = + private final HashMap policyControllers = new HashMap<>(); /** * Group/Artifact Ids Index. */ - private final HashMap coordinates2Controller = + private final HashMap coordinates2Controller = new HashMap<>(); /** @@ -295,7 +294,7 @@ class IndexedPolicyControllerFactory implements PolicyControllerFactory { } synchronized (this) { - String key = toKey(groupId,artifactId); + String key = toKey(groupId, artifactId); if (this.coordinates2Controller.containsKey(key)) { return this.coordinates2Controller.get(key); } else { diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java index 5ab06b37..b58bcf5b 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java @@ -829,7 +829,7 @@ class PolicyEngineManager implements PolicyEngine { } private void attempt(AtomicReference success, List items, PredicateWithEx pred, - BiConsumer handleEx) { + BiConsumer handleEx) { for (T item : items) { try { @@ -848,7 +848,7 @@ class PolicyEngineManager implements PolicyEngine { } private void applyAll(List items, Consumer function, - BiConsumer handleEx) { + BiConsumer handleEx) { for (T item : items) { try { diff --git a/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsControllerUpgradesTest.java b/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsControllerUpgradesTest.java index aa4b2c61..db2062f4 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsControllerUpgradesTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsControllerUpgradesTest.java @@ -187,7 +187,7 @@ public class MavenDroolsControllerUpgradesTest { controller.getContainer() .getPolicySession(KBSESSION_RULES) .getKieSession() - .addEventListener( new RuleRuntimeEventListener() { + .addEventListener(new RuleRuntimeEventListener() { @Override public void objectInserted(ObjectInsertedEvent objectInsertedEvent) { logger.info("RULE {}: inserting {}", @@ -205,7 +205,7 @@ public class MavenDroolsControllerUpgradesTest { logger.info("RULE {}: deleting {}", objectDeletedEvent.getRule().getName(), objectDeletedEvent.getOldObject()); } - } ); + }); controller.getContainer() .getPolicySession(KBSESSION_RULES) @@ -265,6 +265,6 @@ public class MavenDroolsControllerUpgradesTest { public void afterRuleFlowGroupDeactivated(RuleFlowGroupDeactivatedEvent ruleFlowGroupDeactivatedEvent) { /* do nothing */ } - } ); + }); } } -- cgit 1.2.3-korg