aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2018-12-06 08:13:23 -0600
committersonartech <sonartech@sonarsource.com>2019-01-16 09:43:06 +0100
commit07054006cb435f38b30336133cd8e37d9767619e (patch)
tree7636e824ae07d98d07eac6e780ca5d25baaf87e0 /server/sonar-db-dao
parent500260676895673cac016e76b6ec3a18a6757a0c (diff)
downloadsonarqube-07054006cb435f38b30336133cd8e37d9767619e.tar.gz
sonarqube-07054006cb435f38b30336133cd8e37d9767619e.zip
SONAR-11464 Fix migration of branches and add IT
Diffstat (limited to 'server/sonar-db-dao')
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java
index dc0c97814a7..84d686173c9 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java
@@ -41,8 +41,8 @@ import org.sonar.db.Dao;
import org.sonar.db.DbSession;
import static com.google.common.base.Preconditions.checkArgument;
-import static org.sonar.core.component.ComponentKeys.checkModuleKey;
-import static org.sonar.core.component.ComponentKeys.isValidModuleKey;
+import static org.sonar.core.component.ComponentKeys.checkProjectKey;
+import static org.sonar.core.component.ComponentKeys.isValidProjectKey;
/**
* Class used to rename the key of a project and its resources.
@@ -94,7 +94,7 @@ public class ComponentKeyUpdaterDao implements Dao {
ResourceDto::getKey,
component -> {
String newKey = computeNewKey(component.getKey(), stringToReplace, replacementString);
- checkModuleKey(newKey);
+ checkProjectKey(newKey);
return newKey;
}));
}
@@ -233,7 +233,7 @@ public class ComponentKeyUpdaterDao implements Dao {
private static void checkNewNameOfAllModules(Set<ResourceDto> modules, String stringToReplace, String replacementString, ComponentKeyUpdaterMapper mapper) {
for (ResourceDto module : modules) {
String newKey = computeNewKey(module.getKey(), stringToReplace, replacementString);
- checkArgument(isValidModuleKey(newKey), "Malformed key for '%s'. Allowed characters are alphanumeric, '-', '_', '.' and ':', with at least one non-digit.", newKey);
+ checkArgument(isValidProjectKey(newKey), "Malformed key for '%s'. Allowed characters are alphanumeric, '-', '_', '.' and ':', with at least one non-digit.", newKey);
if (mapper.countResourceByKey(newKey) > 0) {
throw new IllegalArgumentException("Impossible to update key: a component with key \"" + newKey + "\" already exists.");
}