From: Julien Lancelot Date: Wed, 2 Jul 2014 07:16:53 +0000 (+0200) Subject: Fix quality flaws X-Git-Tag: 4.4-RC1~24 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=93d72d7a45b3e4ffb7098254e7fc61fffeb2417b;p=sonarqube.git Fix quality flaws --- diff --git a/sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleNormalizer.java b/sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleNormalizer.java index ce6f8dc6f1b..3160acf8854 100644 --- a/sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleNormalizer.java +++ b/sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleNormalizer.java @@ -37,12 +37,7 @@ import org.sonar.server.search.Indexable; import org.sonar.server.search.es.ListUpdate; import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; public class ActiveRuleNormalizer extends BaseNormalizer { @@ -133,6 +128,9 @@ public class ActiveRuleNormalizer extends BaseNormalizer { @@ -220,20 +215,21 @@ public class RuleNormalizer extends BaseNormalizer { if (defaultSubCharacteristicId != null) { CharacteristicDto characteristic, subCharacteristic = null; subCharacteristic = db.debtCharacteristicDao().selectById(defaultSubCharacteristicId, session); - if (subCharacteristic != null) { Integer characteristicId = subCharacteristic.getParentId(); - characteristic = db.debtCharacteristicDao().selectById(characteristicId); - if (characteristic != null) { - update.put(RuleField.DEFAULT_CHARACTERISTIC.field(), characteristic.getKey()); - update.put(RuleField.DEFAULT_SUB_CHARACTERISTIC.field(), subCharacteristic.getKey()); + if (characteristicId != null) { + characteristic = db.debtCharacteristicDao().selectById(characteristicId); + if (characteristic != null) { + update.put(RuleField.DEFAULT_CHARACTERISTIC.field(), characteristic.getKey()); + update.put(RuleField.DEFAULT_SUB_CHARACTERISTIC.field(), subCharacteristic.getKey()); + } } } } Integer subCharacteristicId = rule.getSubCharacteristicId(); if (subCharacteristicId != null) { - if (subCharacteristicId == -1) { + if (subCharacteristicId.equals(-1)) { update.put(RuleField.CHARACTERISTIC.field(), DebtCharacteristic.NONE); update.put(RuleField.SUB_CHARACTERISTIC.field(), DebtCharacteristic.NONE); } else {