aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-12-11 12:18:41 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2013-12-11 12:20:12 +0100
commit2fe211c408a399b5b3980ec6cdfea974f73aff4e (patch)
tree8ea86801c4c0269030f9a9529889d2783b3aa5df
parent6e76fedc7e6b1d382ded15469eda7e978f2d816e (diff)
downloadsonarqube-2fe211c408a399b5b3980ec6cdfea974f73aff4e.tar.gz
sonarqube-2fe211c408a399b5b3980ec6cdfea974f73aff4e.zip
SONAR-4535 Update error message when several permission templates are matching key
-rw-r--r--sonar-core/src/main/java/org/sonar/core/permission/PermissionFacade.java12
-rw-r--r--sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java2
2 files changed, 9 insertions, 5 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/permission/PermissionFacade.java b/sonar-core/src/main/java/org/sonar/core/permission/PermissionFacade.java
index 670a4db7385..2c7876b23ae 100644
--- a/sonar-core/src/main/java/org/sonar/core/permission/PermissionFacade.java
+++ b/sonar-core/src/main/java/org/sonar/core/permission/PermissionFacade.java
@@ -30,7 +30,11 @@ import org.sonar.api.task.TaskComponent;
import org.sonar.core.persistence.MyBatis;
import org.sonar.core.resource.ResourceDao;
import org.sonar.core.resource.ResourceDto;
-import org.sonar.core.user.*;
+import org.sonar.core.user.GroupDto;
+import org.sonar.core.user.GroupRoleDto;
+import org.sonar.core.user.RoleDao;
+import org.sonar.core.user.UserDao;
+import org.sonar.core.user.UserRoleDto;
import javax.annotation.Nullable;
@@ -249,14 +253,14 @@ public class PermissionFacade implements TaskComponent, ServerComponent {
if (matchingTemplates.size() > 1) {
StringBuilder templatesNames = new StringBuilder();
for (Iterator<PermissionTemplateDto> it = matchingTemplates.iterator(); it.hasNext();) {
- templatesNames.append("'").append(it.next().getName()).append("'");
+ templatesNames.append("\"").append(it.next().getName()).append("\"");
if (it.hasNext()) {
templatesNames.append(", ");
}
}
throw new IllegalStateException(MessageFormat.format(
- "The following permission templates have a key pattern that matches the ''{0}'' key: {1}."
- + " The administrator must update them to make sure that only one permission template can be selected for 'foo.project' component.", componentKey,
+ "The \"{0}\" key matches multiple permission templates: {1}."
+ + " A system administrator must update these templates so that only one of them matches the key.", componentKey,
templatesNames.toString()));
}
}
diff --git a/sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java b/sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java
index e6ee175050e..d18ed380bc1 100644
--- a/sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java
@@ -135,7 +135,7 @@ public class DefaultResourcePermissionsTest extends AbstractDaoTestCase {
throwable.expect(IllegalStateException.class);
throwable
- .expectMessage("The following permission templates have a key pattern that matches the 'foo.project' key: 'Start with foo', 'Start with foo again'. The administrator must update them to make sure that only one permission template can be selected for foo.project component.");
+ .expectMessage("The \"foo.project\" key matches multiple permission templates: \"Start with foo\", \"Start with foo again\". A system administrator must update these templates so that only one of them matches the key.");
permissions.grantDefaultRoles(project);