summaryrefslogtreecommitdiffstats
path: root/sonar-batch/src
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2016-03-15 16:02:45 +0100
committerDuarte Meneses <duarte.meneses@sonarsource.com>2016-03-15 16:40:24 +0100
commit1974edc40b343aaf0a0e6028af4fca7f8153dbd5 (patch)
tree33aee692f1e92ee696080ce73a5454347edbd331 /sonar-batch/src
parent9cf13638be2e9d4a257183378a948554644079d5 (diff)
downloadsonarqube-1974edc40b343aaf0a0e6028af4fca7f8153dbd5.tar.gz
sonarqube-1974edc40b343aaf0a0e6028af4fca7f8153dbd5.zip
SONAR-7153 Allow to override sonar.language with blank value
Diffstat (limited to 'sonar-batch/src')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/phases/ProjectInitializer.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/ProjectInitializer.java b/sonar-batch/src/main/java/org/sonar/batch/phases/ProjectInitializer.java
index 59226eb9ff0..8dac11520e5 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/phases/ProjectInitializer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/phases/ProjectInitializer.java
@@ -20,12 +20,13 @@
package org.sonar.batch.phases;
import org.sonar.api.batch.BatchSide;
+import org.apache.commons.lang.StringUtils;
import org.sonar.api.CoreProperties;
import org.sonar.api.config.Settings;
import org.sonar.api.resources.Language;
import org.sonar.api.resources.Languages;
import org.sonar.api.resources.Project;
-import org.sonar.api.utils.SonarException;
+import org.sonar.api.utils.MessageException;
/**
* Should be dropped when org.sonar.api.resources.Project is fully refactored.
@@ -49,10 +50,10 @@ public class ProjectInitializer {
private void initDeprecatedLanguage(Project project) {
String languageKey = settings.getString(CoreProperties.PROJECT_LANGUAGE_PROPERTY);
- if (languageKey != null) {
+ if (StringUtils.isNotBlank(languageKey)) {
Language language = languages.get(languageKey);
if (language == null) {
- throw new SonarException("Language with key '" + languageKey + "' not found");
+ throw MessageException.of("Language with key '" + languageKey + "' not found");
}
project.setLanguage(language);
} else {