]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5056 Do nothing hen rule has no default characteristic or overridden characteristic
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 17 Mar 2014 11:45:17 +0000 (12:45 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 17 Mar 2014 11:45:17 +0000 (12:45 +0100)
sonar-batch/src/main/java/org/sonar/batch/rule/RulesProvider.java
sonar-core/src/main/java/org/sonar/core/rule/RuleDto.java

index 0b2332bc4fcafb03dd6c24c11e0d04a1db28f427..5732f129663e460aa4414f14e0bbac5b25ef64a9 100644 (file)
@@ -79,7 +79,7 @@ public class RulesProvider extends ProviderAdapter {
         .setStatus(RuleStatus.valueOf(ruleDto.getStatus()));
       // TODO should we set metadata ?
 
-      if (!ruleDto.isCharacteristicDisabled()) {
+      if (ruleDto.hasCharacteristic()) {
         newRule.setCharacteristic(characteristic(ruleDto, ruleKey, debtModel).key());
         setFunction(ruleDto, newRule, ruleKey, durations);
       }
index d0a8b978db3c1f4acbf6582561526b65cd258f1b..b6b280cf96b3149c70abed1ffa6db6a7cfb673a7 100644 (file)
@@ -314,8 +314,8 @@ public final class RuleDto {
     return this;
   }
 
-  public boolean isCharacteristicDisabled(){
-    return DISABLED_CHARACTERISTIC_ID.equals(characteristicId);
+  public boolean hasCharacteristic(){
+    return (characteristicId != null && !DISABLED_CHARACTERISTIC_ID.equals(characteristicId)) || defaultCharacteristicId != null;
   }
 
   @Override