[POLICY-8] clean pdp-d from sonar blockers 45/6145/1
authorJorge Hernandez <jh1730@att.com>
Fri, 21 Jul 2017 13:43:43 +0000 (08:43 -0500)
committerJorge Hernandez <jh1730@att.com>
Fri, 21 Jul 2017 13:43:43 +0000 (08:43 -0500)
Change-Id: I25427a0505e2fdd2b0b939f652452cb4f9f07f02
Signed-off-by: Jorge Hernandez <jh1730@att.com>
policy-core/src/main/java/org/openecomp/policy/drools/core/PolicyContainer.java
policy-core/src/main/java/org/openecomp/policy/drools/core/PolicySession.java
policy-management/src/main/java/org/openecomp/policy/drools/protocol/coders/JsonProtocolFilter.java
policy-management/src/main/java/org/openecomp/policy/drools/protocol/coders/ProtocolCoderToolset.java

index 34988d3..65bd547 100644 (file)
@@ -352,8 +352,14 @@ public class PolicyContainer implements Startable
 
        if(name == null){
                logger.warn("adoptKieSession:input name is null");
+               throw(new IllegalArgumentException
+                                 ("KieSession input name is null "
+                                  + getName()));
        }else if(kieSession == null){
                logger.warn("adoptKieSession:input kieSession is null");
+               throw(new IllegalArgumentException
+                                 ("KieSession '" + name + "' is null "
+                                  + getName()));
        }else {
                logger.info("adoptKieSession:name: " + name + " kieSession: " + kieSession);
        }
index 4eb088c..431d166 100644 (file)
@@ -565,7 +565,7 @@ public class PolicySession
                          // if we fall through, it means 'KieSession.halt()' was called,
                          // but this may be a result of 'KieScanner' doing an update
                        }
-                 catch (Throwable e)
+                 catch (Exception | LinkageError e)
                        {
                          logger.error("startThread error in kieSession.fireUntilHalt", e);                                             
                        }
index d6146a3..7831e7b 100644 (file)
@@ -189,7 +189,7 @@ public class JsonProtocolFilter {
                }
                
                try {
-                       if (json == null || !json.isJsonObject()) {
+                       if (!json.isJsonObject()) {
                                return false;
                        }
                        
index fb3f95d..bf7a43f 100644 (file)
@@ -642,13 +642,10 @@ class GsonProtocolCoderToolset extends ProtocolCoderToolset {
                        throws IllegalArgumentException, UnsupportedOperationException {        
                
                DroolsController droolsController = 
-                               DroolsController.factory.get(groupId, artifactId, "");
+                               DroolsController.factory.get(groupId, artifactId, null);
                if (droolsController == null) {
                        logger.info("{}: no drools-controller to process {} (continue)", this, event);
-                       if (this.customCoder != null) {
-                               logger.warn("{}: no drools-controller to process {}", this, event);
-                               throw new IllegalStateException("custom-coder but no drools-controller");
-                       }
+                       throw new IllegalStateException("custom-coder but no drools-controller");
                }
                
                if (this.customCoder != null) {