diff options
author | Lukasz Jarocki <lukasz.jarocki@sonarsource.com> | 2023-01-09 10:21:58 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-01-09 20:03:08 +0000 |
commit | 146e8dc7937fdc768961039db90f53613521abb1 (patch) | |
tree | e189c6a6a624a68107959c63f3fc9ebf9479a12e /server/sonar-webserver-webapi | |
parent | d65568551dd4d46a7aa62ab3021f419ad4e3e78e (diff) | |
download | sonarqube-146e8dc7937fdc768961039db90f53613521abb1.tar.gz sonarqube-146e8dc7937fdc768961039db90f53613521abb1.zip |
SONAR-17775 fixed a bug where old portfolio and app XMLs could not be sometimes imported
Diffstat (limited to 'server/sonar-webserver-webapi')
2 files changed, 3 insertions, 4 deletions
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ComponentUpdater.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ComponentUpdater.java index edcabaeb833..b64b4ee70db 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ComponentUpdater.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ComponentUpdater.java @@ -104,9 +104,8 @@ public class ComponentUpdater { * - Index component in es indexes */ public ComponentDto createApplicationOrPortfolio(DbSession dbSession, NewComponent newComponent, @Nullable String userUuid, - @Nullable String userLogin) { - ComponentDto componentDto = createWithoutCommit(dbSession, newComponent, userUuid, userLogin, - defaultBranchNameResolver.getEffectiveMainBranchName(), c -> {}); + @Nullable String userLogin, @Nullable String mainBranchName) { + ComponentDto componentDto = createWithoutCommit(dbSession, newComponent, userUuid, userLogin, mainBranchName, c -> {}); commitAndIndex(dbSession, componentDto); return componentDto; } diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/component/ComponentUpdaterTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/component/ComponentUpdaterTest.java index 1c16cdbd0e5..a2b789ca7f5 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/component/ComponentUpdaterTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/component/ComponentUpdaterTest.java @@ -340,7 +340,7 @@ public class ComponentUpdaterTest { public void createApplicationOrPortfolio_createsComponentWithMasterBranchName() { String componentNameAndKey = "createApplicationOrPortfolio"; ComponentDto app = underTest.createApplicationOrPortfolio(db.getSession(), - NewComponent.newComponentBuilder().setName(componentNameAndKey).setKey(componentNameAndKey).setQualifier("APP").build(), null, null); + NewComponent.newComponentBuilder().setName(componentNameAndKey).setKey(componentNameAndKey).setQualifier("APP").build(), null, null, null); Optional<BranchDto> branch = db.getDbClient().branchDao().selectByUuid(db.getSession(), app.branchUuid()); assertThat(branch).isPresent(); |