aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-search/src/main/java/org/sonar/search/SearchSettings.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivatorContext.java1
3 files changed, 6 insertions, 5 deletions
diff --git a/server/sonar-search/src/main/java/org/sonar/search/SearchSettings.java b/server/sonar-search/src/main/java/org/sonar/search/SearchSettings.java
index bab755bc722..c939d0cb2cc 100644
--- a/server/sonar-search/src/main/java/org/sonar/search/SearchSettings.java
+++ b/server/sonar-search/src/main/java/org/sonar/search/SearchSettings.java
@@ -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
diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java
index 030d81cd45f..8026d90518d 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java
@@ -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);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivatorContext.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivatorContext.java
index e779be00911..12aa30cf88e 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivatorContext.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivatorContext.java
@@ -152,7 +152,6 @@ class RuleActivatorContext {
return rule.getSeverityString();
}
- @CheckForNull
Map<String, ActiveRuleParamDto> activeRuleParamsAsMap() {
return activeRuleParams;
}