aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-10-27 13:50:44 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2014-10-27 13:51:43 +0100
commit45ed35bc23e7265bd8eb9bb454f86d7744d39f8d (patch)
treef999ee6e9dc0ed2ca597354f4fecaa29cae2cee8 /sonar-core/src
parent5af0f8236cbabfc99ba2e401d69e3918e91256d8 (diff)
downloadsonarqube-45ed35bc23e7265bd8eb9bb454f86d7744d39f8d.tar.gz
sonarqube-45ed35bc23e7265bd8eb9bb454f86d7744d39f8d.zip
SONAR-3718 Add support for '/' character in branch names
Diffstat (limited to 'sonar-core/src')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/component/ComponentKeys.java6
-rw-r--r--sonar-core/src/test/java/org/sonar/core/component/ComponentKeysTest.java3
2 files changed, 5 insertions, 4 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/component/ComponentKeys.java b/sonar-core/src/main/java/org/sonar/core/component/ComponentKeys.java
index 67d2f112b3c..615fe1304b4 100644
--- a/sonar-core/src/main/java/org/sonar/core/component/ComponentKeys.java
+++ b/sonar-core/src/main/java/org/sonar/core/component/ComponentKeys.java
@@ -35,9 +35,9 @@ public final class ComponentKeys {
*/
private static final String VALID_MODULE_KEY_REGEXP = "[\\p{Alnum}\\-_.:]*[\\p{Alpha}\\-_.:]+[\\p{Alnum}\\-_.:]*";
/*
- * Allowed characters are alphanumeric, '-', '_' and '.'
+ * Allowed characters are alphanumeric, '-', '_', '.' and '/'
*/
- private static final String VALID_BRANCH_REGEXP = "[\\p{Alnum}\\-_.]*";
+ private static final String VALID_BRANCH_REGEXP = "[\\p{Alnum}\\-_./]*";
private static final String KEY_WITH_BRANCH_FORMAT = "%s:%s";
@@ -101,7 +101,7 @@ public final class ComponentKeys {
* <li>Uppercase ASCII letters A-Z</li>
* <li>Lowercase ASCII letters a-z</li>
* <li>ASCII digits 0-9</li>
- * <li>Punctuation signs dash '-', underscore '_', and period '.'</li>
+ * <li>Punctuation signs dash '-', underscore '_', period '.', and '/'</li>
* </ul>
* </li>
* </ul>
diff --git a/sonar-core/src/test/java/org/sonar/core/component/ComponentKeysTest.java b/sonar-core/src/test/java/org/sonar/core/component/ComponentKeysTest.java
index 3c4d0e78063..8b8c33025cc 100644
--- a/sonar-core/src/test/java/org/sonar/core/component/ComponentKeysTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/component/ComponentKeysTest.java
@@ -62,7 +62,8 @@ public class ComponentKeysTest {
assertThat(ComponentKeys.isValidBranch("0123")).isTrue();
assertThat(ComponentKeys.isValidBranch("ab 12")).isFalse();
assertThat(ComponentKeys.isValidBranch("ab_12")).isTrue();
- assertThat(ComponentKeys.isValidBranch("ab/12")).isFalse();
+ assertThat(ComponentKeys.isValidBranch("ab/12")).isTrue();
+ assertThat(ComponentKeys.isValidBranch("ab\\12")).isFalse();
}
}