Solve the Critical Issue in Sonar
authorGuangrongFu <fu.guangrong@zte.com.cn>
Fri, 24 Feb 2017 07:01:18 +0000 (15:01 +0800)
committerGuangrongFu <fu.guangrong@zte.com.cn>
Fri, 24 Feb 2017 07:01:18 +0000 (15:01 +0800)
Change-Id: I12231dfef13215b8eb7ddec2224780dc62c46c54
Issue-ID: HOLMES-47
Signed-off-by: GuangrongFu <fu.guangrong@zte.com.cn>
engine-d/src/main/java/org/openo/holmes/engine/manager/DroolsEngine.java

index 4ae66df..b6d867f 100644 (file)
@@ -91,7 +91,7 @@ public class DroolsEngine {
             // 2. start mq listener
             registerAlarmTopicListener();
         } catch (Exception e) {
-            log.error("Start service failed: " + e.getMessage());
+            log.error("Start service failed: " + e.getMessage(), e);
             throw ExceptionUtil.buildExceptionResponse("Start service failed!");
         }
     }
@@ -108,15 +108,15 @@ public class DroolsEngine {
 
 
     private void start() throws EngineException, RuleIllegalityException, DbException {
-        log.info("Drools Egine Initialize Begining ... ");
+        log.info("Drools Engine Initialize Beginning...");
 
         initEngineParameter();
         initDeployRule();
 
-        log.info("Business Rule Egine Initialize Successfully ");
+        log.info("Business Rule Engine Initialize Successfully.");
     }
 
-    public void stop() throws Exception {
+    public void stop() {
         this.ksession.dispose();
     }
 
@@ -137,7 +137,7 @@ public class DroolsEngine {
     private void initDeployRule() throws RuleIllegalityException, EngineException, DbException {
         List<CorrelationRule> rules = ruleMgtWrapper.queryRuleByEnable(ENABLE);
 
-        if (rules.size() > 0) {
+        if (!rules.isEmpty()) {
             for (CorrelationRule rule : rules) {
                 if (rule.getContent() != null) {
                     deployRuleFromCache(rule.getContent());
@@ -284,7 +284,7 @@ public class DroolsEngine {
                     }
                 }
             } catch (JMSException e) {
-                log.error("connection mq service Failed: " + e.getMessage());
+                log.error("connection mq service Failed: " + e.getMessage(), e);
             }
 
         }