From: Stephane Gamard Date: Tue, 1 Jul 2014 16:17:51 +0000 (+0200) Subject: fix quality flaws X-Git-Tag: 4.4-RC1~38 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=33a64a5c88d4ed19175112effe4fa53e3e385e27;p=sonarqube.git fix quality flaws --- diff --git a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java index b90b835440a..08e5f919ddd 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java +++ b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleDoc.java @@ -34,7 +34,6 @@ import org.sonar.server.search.IndexUtils; import javax.annotation.CheckForNull; import javax.annotation.Nullable; - import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -198,11 +197,13 @@ public class RuleDoc extends BaseDoc implements Rule { @Override @CheckForNull public String debtCharacteristicKey() { - if (getNullableField(RuleNormalizer.RuleField.CHARACTERISTIC.field()) != null) { - if (((String) getNullableField(RuleNormalizer.RuleField.CHARACTERISTIC.field())).isEmpty()) { + String field = RuleNormalizer.RuleField.CHARACTERISTIC.field(); + String value = (String) getNullableField(field); + if (value != null) { + if (value.isEmpty()) { return null; } else { - return (String) getNullableField(RuleNormalizer.RuleField.CHARACTERISTIC.field()); + return value; } } else { return defaultDebtCharacteristicKey(); @@ -212,11 +213,13 @@ public class RuleDoc extends BaseDoc implements Rule { @Override @CheckForNull public String debtSubCharacteristicKey() { - if (getNullableField(RuleNormalizer.RuleField.SUB_CHARACTERISTIC.field()) != null) { - if (((String) getNullableField(RuleNormalizer.RuleField.SUB_CHARACTERISTIC.field())).isEmpty()) { + String field = RuleNormalizer.RuleField.SUB_CHARACTERISTIC.field(); + String value = (String) getNullableField(field); + if (value != null) { + if (value.isEmpty()) { return null; } else { - return (String) getNullableField(RuleNormalizer.RuleField.SUB_CHARACTERISTIC.field()); + return value; } } else { return defaultDebtSubCharacteristicKey();