From b7e8093072635524adba8040858b7aa3290a0a5d Mon Sep 17 00:00:00 2001 From: Stephane Gamard Date: Thu, 14 Aug 2014 15:38:21 +0200 Subject: [PATCH] Revert Props setDefault --- .../src/main/java/org/sonar/process/Props.java | 9 +++++++++ .../main/java/org/sonar/application/DefaultSettings.java | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/server/process/sonar-process/src/main/java/org/sonar/process/Props.java b/server/process/sonar-process/src/main/java/org/sonar/process/Props.java index 45a630c365c..d6e2795a597 100644 --- a/server/process/sonar-process/src/main/java/org/sonar/process/Props.java +++ b/server/process/sonar-process/src/main/java/org/sonar/process/Props.java @@ -19,6 +19,8 @@ */ package org.sonar.process; +import org.apache.commons.lang.StringUtils; + import javax.annotation.CheckForNull; import javax.annotation.Nullable; import java.io.File; @@ -95,4 +97,11 @@ public class Props { } return this; } + + public void setDefault(String key, String value) { + String s = properties.getProperty(key); + if (StringUtils.isBlank(s)) { + properties.setProperty(key, value); + } + } } diff --git a/sonar-application/src/main/java/org/sonar/application/DefaultSettings.java b/sonar-application/src/main/java/org/sonar/application/DefaultSettings.java index 7a3bca0d100..e6d737487ac 100644 --- a/sonar-application/src/main/java/org/sonar/application/DefaultSettings.java +++ b/sonar-application/src/main/java/org/sonar/application/DefaultSettings.java @@ -49,7 +49,7 @@ class DefaultSettings { // init string properties for (Map.Entry entry : defaults().entrySet()) { - props.set(entry.getKey(), entry.getValue()); + props.setDefault(entry.getKey(), entry.getValue()); } // init ports -- 2.39.5