]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5067 Update message displayed when activating already activated rules on a...
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 26 Feb 2014 14:01:09 +0000 (15:01 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 26 Feb 2014 14:01:17 +0000 (15:01 +0100)
sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java
sonar-plugin-api/src/test/java/org/sonar/api/profiles/RulesProfileTest.java

index c8ac0082627b56cebda1b97ed9d771dbed13a7e4..d0abfb4bf924c0eac8fd7f8468747a73c985cc50 100644 (file)
@@ -376,9 +376,10 @@ public class RulesProfile implements Cloneable {
       public boolean apply(ActiveRule input) {
         return input.getRule().equals(rule);
       }
-    })){
-      throw new IllegalStateException(String.format("The rule '%s:%s' is already activated on the profile '%s' (language '%s')",
-        rule.getRepositoryKey(), rule.getKey(), getName(), getLanguage()));
+    })) {
+      throw new IllegalStateException(String.format(
+        "The definition of the profile '%s' (language '%s') contains multiple occurrences of the '%s:%s' rule. The plugin which declares this profile should fix this.",
+        getName(), getLanguage(), rule.getRepositoryKey(), rule.getKey()));
     }
     ActiveRule activeRule = new ActiveRule();
     activeRule.setRule(rule);
index 3a31a73b060f91edc9487b4b682e6de0e733a50d..79275aa24224baefc52a386cf32f25c88b6ecc15 100644 (file)
@@ -71,7 +71,8 @@ public class RulesProfileTest {
       profile.activateRule(rule, null);
       fail();
     } catch (Exception e) {
-      assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("The rule 'repo:key1' is already activated on the profile 'Default' (language 'java')");
+      assertThat(e).isInstanceOf(IllegalStateException.class)
+        .hasMessage("The definition of the profile 'Default' (language 'java') contains multiple occurrences of the 'repo:key1' rule. The plugin which declares this profile should fix this.");
     }
   }
 }