From e9257d9ddcf42d367997443259f345d8b1b301ff Mon Sep 17 00:00:00 2001 From: youbowu Date: Thu, 2 Mar 2017 16:02:59 +0800 Subject: Fix in rule management the sonar detected error Issue-ID:HOLMES-50 Change-Id: Ic61e8137521617188fae1d149aad40c88b65e684 Signed-off-by: youbowu --- .../java/org/openo/holmes/rulemgt/db/CorrelationRuleDao.java | 10 +++++----- .../org/openo/holmes/rulemgt/db/CorrelationRuleQueryDao.java | 7 ++----- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'rulemgt/src/main') diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleDao.java b/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleDao.java index aa2cccc..f800f0c 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleDao.java +++ b/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleDao.java @@ -67,7 +67,7 @@ public abstract class CorrelationRuleDao { addRule(correlationRule); return correlationRule; } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR); + throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e); } } @@ -75,7 +75,7 @@ public abstract class CorrelationRuleDao { try { updateRuleByRid(correlationRule); } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR); + throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e); } } @@ -83,7 +83,7 @@ public abstract class CorrelationRuleDao { try { deleteRule2DbInner(correlationRule); } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR); + throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e); } } @@ -92,7 +92,7 @@ public abstract class CorrelationRuleDao { try { return queryRuleById(rid); } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR); + throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e); } } @@ -100,7 +100,7 @@ public abstract class CorrelationRuleDao { try { return queryRuleByName(name); } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR); + throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e); } } } diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleQueryDao.java b/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleQueryDao.java index 075da00..d77cc09 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleQueryDao.java +++ b/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleQueryDao.java @@ -117,11 +117,8 @@ public class CorrelationRuleQueryDao { } } } - if (whereSql.indexOf("AND") > -1) { - whereSql = whereSql.trim(); - return whereSql.substring(0, whereSql.length() - "AND".length()); - } - return ""; + whereSql = whereSql.trim(); + return whereSql.substring(0, whereSql.length() - "AND".length()); } catch (Exception e) { throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED, e); } -- cgit 1.2.3-korg