aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2015-09-17 17:41:13 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2015-09-18 15:32:56 +0200
commit21f0481e9ffd9c9130c58e7331f3dfad8f40b9da (patch)
tree4194f7d6829b740c30bedfdd88e7148a73393ce7
parentf6379f845f81674811df7d2c0735ffaf4066daa0 (diff)
downloadsonarqube-21f0481e9ffd9c9130c58e7331f3dfad8f40b9da.tar.gz
sonarqube-21f0481e9ffd9c9130c58e7331f3dfad8f40b9da.zip
SONAR-6840 Number are accepted in table name
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/ColumnDefValidation.java3
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/ColumnDefValidationTest.java1
2 files changed, 3 insertions, 1 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/version/ColumnDefValidation.java b/sonar-db/src/main/java/org/sonar/db/version/ColumnDefValidation.java
index ed017bcb705..786388fef96 100644
--- a/sonar-db/src/main/java/org/sonar/db/version/ColumnDefValidation.java
+++ b/sonar-db/src/main/java/org/sonar/db/version/ColumnDefValidation.java
@@ -35,7 +35,8 @@ public class ColumnDefValidation {
public static String validateColumnName(@Nullable String columnName) {
String name = requireNonNull(columnName, "Column name cannot be null");
- checkArgument(JAVA_LOWER_CASE.or(CharMatcher.anyOf("_")).matchesAllOf(name), String.format("Column name should only contains lowercase and _ characters, got '%s'", columnName));
+ checkArgument(JAVA_LOWER_CASE.or(CharMatcher.anyOf("_")).or(CharMatcher.DIGIT).matchesAllOf(name),
+ String.format("Column name should only contains lowercase and _ characters, got '%s'", columnName));
return name;
}
}
diff --git a/sonar-db/src/test/java/org/sonar/db/version/ColumnDefValidationTest.java b/sonar-db/src/test/java/org/sonar/db/version/ColumnDefValidationTest.java
index 6cbdb35d58e..423a49356bf 100644
--- a/sonar-db/src/test/java/org/sonar/db/version/ColumnDefValidationTest.java
+++ b/sonar-db/src/test/java/org/sonar/db/version/ColumnDefValidationTest.java
@@ -34,6 +34,7 @@ public class ColumnDefValidationTest {
@Test
public void accept_valid_table_name() throws Exception {
validateColumnName("date_in_ms");
+ validateColumnName("date_in_ms_1");
}
@Test