diff options
author | Jorge Hernandez <jh1730@att.com> | 2017-08-02 18:16:28 -0500 |
---|---|---|
committer | Jorge Hernandez <jh1730@att.com> | 2017-08-02 18:16:28 -0500 |
commit | bee1dd6744c9037d96f03fa439b7b13c71df0a8b (patch) | |
tree | 07ea436bb2729325ba09d97b56025a22e1621e4a /policy-management/src | |
parent | f1635fe8e027e9230066b04f5768bb9a5ba0124b (diff) |
[POLICY-114] fix some sonar criticals
Change-Id: Ic79b3d81ac814948ce3a956fe4c32b8a9b5c0009
Signed-off-by: Jorge Hernandez <jh1730@att.com>
Diffstat (limited to 'policy-management/src')
4 files changed, 11 insertions, 16 deletions
diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java index c4c61a8a..f531c441 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java @@ -164,7 +164,7 @@ public interface DroolsController extends Startable, Lockable { public void updateToVersion(String newGroupId, String newArtifactId, String newVersion, List<TopicCoderFilterConfiguration> decoderConfigurations, List<TopicCoderFilterConfiguration> encoderConfigurations) - throws IllegalArgumentException, LinkageError, Exception; + throws IllegalArgumentException, LinkageError; /** * gets the classnames of facts as well as the current count diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java b/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java index c7a63a03..8b733970 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java +++ b/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java @@ -58,12 +58,11 @@ public interface DroolsControllerFactory { * @return the instantiated Drools Controller * @throws IllegalArgumentException with invalid parameters * @throws LinkageError Failure to link rules and models in Drools Libraries - * @throws Exception Exception from Drools Libraries */ public DroolsController build(Properties properties, List<? extends TopicSource> eventSources, List<? extends TopicSink> eventSinks) - throws IllegalArgumentException, LinkageError, Exception; + throws IllegalArgumentException, LinkageError; /** * Explicit construction of a Drools Controller @@ -77,14 +76,13 @@ public interface DroolsControllerFactory { * @return the instantiated Drools Controller * @throws IllegalArgumentException with invalid parameters * @throws LinkageError Failure to link rules and models in Drools Libraries - * @throws Exception Exception from Drools Libraries */ public DroolsController build(String groupId, String artifactId, String version, List<TopicCoderFilterConfiguration> decoderConfigurations, List<TopicCoderFilterConfiguration> encoderConfigurations) - throws IllegalArgumentException, LinkageError, Exception; + throws IllegalArgumentException, LinkageError; /** * Releases the Drools Controller from operation @@ -177,7 +175,7 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { public DroolsController build(Properties properties, List<? extends TopicSource> eventSources, List<? extends TopicSink> eventSinks) - throws IllegalArgumentException, LinkageError, Exception { + throws IllegalArgumentException, LinkageError { String groupId = properties.getProperty(PolicyProperties.RULES_GROUPID); if (groupId == null || groupId.isEmpty()) @@ -380,7 +378,7 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { String newVersion, List<TopicCoderFilterConfiguration> decoderConfigurations, List<TopicCoderFilterConfiguration> encoderConfigurations) - throws IllegalArgumentException, LinkageError, Exception { + throws IllegalArgumentException, LinkageError { if (newGroupId == null || newArtifactId == null || newVersion == null || newGroupId.isEmpty() || newArtifactId.isEmpty() || newVersion.isEmpty()) { 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 db62f782..79743b00 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 @@ -172,7 +172,7 @@ public class MavenDroolsController implements DroolsController { public void updateToVersion(String newGroupId, String newArtifactId, String newVersion, List<TopicCoderFilterConfiguration> decoderConfigurations, List<TopicCoderFilterConfiguration> encoderConfigurations) - throws IllegalArgumentException, LinkageError, Exception { + throws IllegalArgumentException, LinkageError { if (logger.isInfoEnabled()) logger.info("UPDATE-TO-VERSION: " + this + " -> {" + newGroupId + ":" + newArtifactId + ":" + newVersion + "}"); @@ -722,7 +722,7 @@ public class MavenDroolsController implements DroolsController { List<PolicySession> sessions = this.getSessions(); for (PolicySession session : sessions) { - if (sessionName.equals(session.getName()) || sessionName.equals(session.getName())) + if (sessionName.equals(session.getName()) || sessionName.equals(session.getFullName())) return session; } @@ -752,8 +752,7 @@ public class MavenDroolsController implements DroolsController { else classNames.put(className, 1); } catch (Exception e) { - if (logger.isInfoEnabled()) - logger.info("Object cannot be retrieved from fact: " + fact); + logger.warn("Object cannot be retrieved from fact {}", fact, e); } } @@ -800,8 +799,7 @@ public class MavenDroolsController implements DroolsController { if (delete) kieSession.delete(factHandle); } catch (Exception e) { - if (logger.isInfoEnabled()) - logger.info("Object cannot be retrieved from fact: " + factHandle); + logger.warn("Object cannot be retrieved from fact {}", factHandle, e); } } @@ -846,8 +844,7 @@ public class MavenDroolsController implements DroolsController { if (delete) kieSession.delete(row.getFactHandle(queriedEntity)); } catch (Exception e) { - if (logger.isInfoEnabled()) - logger.info("Object cannot be retrieved from fact: " + row); + logger.warn("Object cannot be retrieved from row: {}", row, e); } } diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java index 3fef6fa9..c4db6c7e 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java @@ -221,7 +221,7 @@ public class NullDroolsController implements DroolsController { public void updateToVersion(String newGroupId, String newArtifactId, String newVersion, List<TopicCoderFilterConfiguration> decoderConfigurations, List<TopicCoderFilterConfiguration> encoderConfigurations) - throws IllegalArgumentException, LinkageError, Exception { + throws IllegalArgumentException, LinkageError { throw new IllegalArgumentException(this.getClass().getCanonicalName() + " invoked"); } |