diff options
author | Fabrice Bellingard <bellingard@gmail.com> | 2012-04-02 11:56:58 +0200 |
---|---|---|
committer | Fabrice Bellingard <bellingard@gmail.com> | 2012-04-02 11:56:58 +0200 |
commit | 3293e19f266b1ef48d6ffe4f4116be08d0603c1f (patch) | |
tree | 9e5f92f8cc799a544be3ddd592a570ccc373fbc8 /sonar-batch/src/main/java/org | |
parent | 79f0340fb247465924053de5fb59d5da7e6ba6b6 (diff) | |
download | sonarqube-3293e19f266b1ef48d6ffe4f4116be08d0603c1f.tar.gz sonarqube-3293e19f266b1ef48d6ffe4f4116be08d0603c1f.zip |
SONAR-3125 Add better error message for unknown language
Diffstat (limited to 'sonar-batch/src/main/java/org')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/DefaultProfileLoader.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/DefaultProfileLoader.java b/sonar-batch/src/main/java/org/sonar/batch/DefaultProfileLoader.java index b3779e84b70..35a10a679f7 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/DefaultProfileLoader.java +++ b/sonar-batch/src/main/java/org/sonar/batch/DefaultProfileLoader.java @@ -22,6 +22,7 @@ package org.sonar.batch; import org.sonar.api.profiles.RulesProfile; import org.sonar.api.resources.Project; import org.sonar.api.rules.ActiveRule; +import org.sonar.api.utils.SonarException; import org.sonar.jpa.dao.ProfilesDao; public class DefaultProfileLoader implements ProfileLoader { @@ -40,13 +41,16 @@ public class DefaultProfileLoader implements ProfileLoader { Project root = project.getRoot(); profile = dao.getActiveProfile(root.getLanguageKey(), root.getKey()); if (profile == null) { - throw new RuntimeException("Quality profile not found for " + root.getKey() + ", language " + root.getLanguageKey()); + // This means that the current language is not supported by any installed plugin, otherwise at least a + // "Default <Language Name>" profile would have been created by ActivateDefaultProfiles class. + throw new SonarException("You must intall a Sonar plugin that supports language '" + root.getLanguageKey() + + "' in order to analyse the following project: " + root.getKey()); } } else { profile = dao.getProfile(project.getLanguageKey(), profileName); if (profile == null) { - throw new RuntimeException("Quality profile not found : " + profileName + ", language " + project.getLanguageKey()); + throw new SonarException("Quality profile not found : " + profileName + ", language " + project.getLanguageKey()); } } |