]> source.dussan.org Git - sonarqube.git/commitdiff
Fix quality flaws
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 31 Mar 2015 07:22:14 +0000 (09:22 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 31 Mar 2015 07:22:14 +0000 (09:22 +0200)
server/sonar-search/src/main/java/org/sonar/search/SearchSettings.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivatorContext.java

index bab755bc722b0730345f209936bde4dc16edcd1b..c939d0cb2cc3a89aed2a3764abf76f65b08034b4 100644 (file)
@@ -110,8 +110,9 @@ class SearchSettings {
   }
 
   private void configureNetwork(ImmutableSettings.Builder builder) {
-    String host = props.value(ProcessProperties.SEARCH_HOST);
-    Integer port = props.valueAsInt(ProcessProperties.SEARCH_PORT);
+    // the following properties can't be null as default values are defined by app process
+    String host = props.nonNullValue(ProcessProperties.SEARCH_HOST);
+    int port = Integer.parseInt(props.nonNullValue(ProcessProperties.SEARCH_PORT));
     LOGGER.info("Elasticsearch listening on {}:{}", host, port);
 
     // disable multicast
index 030d81cd45fbf2875a4eadfb54cfbc87f1e98763..8026d90518d34cd1c51f7a396ceeba5856855af9 100644 (file)
@@ -347,10 +347,11 @@ public class RuleActivator implements ServerComponent {
     List<ActiveRuleChange> changes = Lists.newArrayList();
     RuleActivatorContext context = contextFactory.create(key.qProfile(), key.ruleKey(), dbSession);
     ActiveRuleChange change;
-    if (context.activeRule() == null) {
+    ActiveRuleDto activeRuleDto = context.activeRule();
+    if (activeRuleDto == null) {
       return changes;
     }
-    if (!force && !isCascade && context.activeRule().getInheritance() != null) {
+    if (!force && !isCascade && activeRuleDto.getInheritance() != null) {
       throw new BadRequestException("Cannot deactivate inherited rule '" + key.ruleKey() + "'");
     }
     change = ActiveRuleChange.createFor(ActiveRuleChange.Type.DEACTIVATED, key);
index e779be0091145f6a1fe54acbfd81a15b208868c0..12aa30cf88e7f1fa6190ebeab1446a7f79e2fe1e 100644 (file)
@@ -152,7 +152,6 @@ class RuleActivatorContext {
     return rule.getSeverityString();
   }
 
-  @CheckForNull
   Map<String, ActiveRuleParamDto> activeRuleParamsAsMap() {
     return activeRuleParams;
   }