]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-17352 Refactor component keys to not include branch suffix
authorLéo Geoffroy <99647462+leo-geoffroy-sonarsource@users.noreply.github.com>
Fri, 30 Sep 2022 15:14:31 +0000 (17:14 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 12 Oct 2022 20:03:44 +0000 (20:03 +0000)
server/sonar-webserver-webapi/src/main/java/org/sonar/server/source/ws/IssueSnippetsAction.java

index 48dda725e2ee69d3baa71a7506771563901e1333..6d4887c46b9a6cb4f3b57286073e144c7fdee49d 100644 (file)
@@ -100,8 +100,12 @@ public class IssueSnippetsAction implements SourcesWsAction {
         Map<String, ComponentDto> componentsByUuid = dbClient.componentDao().selectByUuids(dbSession, linesPerComponent.keySet())
           .stream().collect(Collectors.toMap(ComponentDto::uuid, c -> c));
 
+        Set<String> branchUuids = componentsByUuid.values().stream()
+          .map(ComponentDto::branchUuid)
+          .collect(Collectors.toSet());
+
         Map<String, BranchDto> branches = dbClient.branchDao()
-          .selectByUuids(dbSession, componentsByUuid.keySet())
+          .selectByUuids(dbSession, branchUuids)
           .stream()
           .collect(Collectors.toMap(BranchDto::getUuid, b -> b));