aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2014-01-21 19:29:56 +0100
committerJulien Lancelot <julien.lancelot@gmail.com>2014-01-21 19:29:56 +0100
commit71953ba685c5155490ad872ceda041320ace9441 (patch)
tree8b93d09d89cafb3ab7dfcdfed305bec5df19d154 /sonar-server
parent95dbe304b988d6063babf06fa9e36960d2611508 (diff)
downloadsonarqube-71953ba685c5155490ad872ceda041320ace9441.tar.gz
sonarqube-71953ba685c5155490ad872ceda041320ace9441.zip
SONAR-4923 Do not allow space in rule values on single select list
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileActiveRuleOperations.java2
-rw-r--r--sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileActiveRuleOperationsTest.java4
2 files changed, 3 insertions, 3 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileActiveRuleOperations.java b/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileActiveRuleOperations.java
index 9a586ab17f6..a78a5488a62 100644
--- a/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileActiveRuleOperations.java
+++ b/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileActiveRuleOperations.java
@@ -422,7 +422,7 @@ public class QProfileActiveRuleOperations implements ServerComponent {
private void validateParam(RuleParamDto ruleParam, String value) {
RuleParamType ruleParamType = RuleParamType.parse(ruleParam.getType());
if (ruleParamType.multiple()) {
- List<String> values = newArrayList(Splitter.on(",").trimResults().split(value));
+ List<String> values = newArrayList(Splitter.on(",").split(value));
typeValidations.validate(values, ruleParamType.type(), ruleParamType.values());
} else {
typeValidations.validate(value, ruleParamType.type(), ruleParamType.values());
diff --git a/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileActiveRuleOperationsTest.java b/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileActiveRuleOperationsTest.java
index 15d5ee4e4d4..1bb56618b8d 100644
--- a/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileActiveRuleOperationsTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileActiveRuleOperationsTest.java
@@ -353,9 +353,9 @@ public class QProfileActiveRuleOperationsTest {
when(ruleDao.selectParamByRuleAndKey(10, "max", session)).thenReturn(ruleParam);
ActiveRuleParamDto activeRuleParam = new ActiveRuleParamDto().setId(100).setActiveRuleId(5).setKey("max").setValue("20");
when(activeRuleDao.selectParamByActiveRuleAndKey(5, "max", session)).thenReturn(activeRuleParam);
- when(profilesManager.ruleParamChanged(eq(1), eq(5), eq("max"), eq("20"), eq("30, 31, 32"), eq("Nicolas"))).thenReturn(new ProfilesManager.RuleInheritanceActions());
+ when(profilesManager.ruleParamChanged(eq(1), eq(5), eq("max"), eq("20"), eq("30,31,32"), eq("Nicolas"))).thenReturn(new ProfilesManager.RuleInheritanceActions());
- operations.updateActiveRuleParam(5, "max", "30, 31, 32", authorizedUserSession);
+ operations.updateActiveRuleParam(5, "max", "30,31,32", authorizedUserSession);
verify(typeValidations).validate(eq(newArrayList("30", "31", "32")), eq("SINGLE_SELECT_LIST"), anyList());
}