aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main/java
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-07-01 22:55:24 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-07-01 23:18:38 +0200
commitf413552b198d92b568d7413fe80990c0484c6455 (patch)
tree32749a7faf75e1c3c9d6de111324efe63684b780 /sonar-server/src/main/java
parent6c0da1115cd26a1e41195c3924d94d46dda0e38b (diff)
downloadsonarqube-f413552b198d92b568d7413fe80990c0484c6455.tar.gz
sonarqube-f413552b198d92b568d7413fe80990c0484c6455.zip
Fix some quality flaws
Diffstat (limited to 'sonar-server/src/main/java')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleNormalizer.java5
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java6
2 files changed, 6 insertions, 5 deletions
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 f6f273a9e68..ce6f8dc6f1b 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
@@ -137,8 +137,9 @@ public class ActiveRuleNormalizer extends BaseNormalizer<ActiveRuleDto, ActiveRu
// TODO this should be generated by RegisterRule and modified in DTO.
String parentKey = null;
- if (activeRuleDto.getParentId() != null) {
- ActiveRuleDto parentDto = db.activeRuleDao().getById(session, activeRuleDto.getParentId());
+ Integer parentId = activeRuleDto.getParentId();
+ if (parentId != null) {
+ ActiveRuleDto parentDto = db.activeRuleDao().getById(session, parentId);
parentKey = parentDto.getKey().toString();
}
newRule.put(ActiveRuleField.PARENT_KEY.field(), parentKey);
diff --git a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java
index e2141f765e1..df2756104bc 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java
@@ -58,7 +58,7 @@ import org.sonar.server.search.QueryOptions;
import org.sonar.server.search.Result;
import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
@@ -366,8 +366,8 @@ public class RuleIndex extends BaseIndex<Rule, RuleDto, RuleKey> {
}
@Override
- protected Rule toDoc(@Nullable Map<String, Object> fields) {
- Preconditions.checkArgument(fields != null, "Cannot construct Rule with null response!!!");
+ protected Rule toDoc(Map<String, Object> fields) {
+ Preconditions.checkNotNull(fields, "Cannot construct Rule with null response");
return new RuleDoc(fields);
}