]> source.dussan.org Git - sonarqube.git/commitdiff
Fix Quality flaw in CE ComponentTreeBuilder
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 30 Jul 2018 13:41:11 +0000 (15:41 +0200)
committerSonarTech <sonartech@sonarsource.com>
Thu, 2 Aug 2018 18:21:35 +0000 (20:21 +0200)
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ComponentTreeBuilder.java

index de1daa2c153e22ed6669633006e03beb0ae3f204..427bb87bd520ab3574c2318618c9608cee963dd9 100644 (file)
@@ -21,13 +21,13 @@ package org.sonar.ce.task.projectanalysis.component;
 
 import java.util.List;
 import java.util.function.Function;
-import java.util.stream.Collectors;
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
+import org.sonar.ce.task.projectanalysis.analysis.Branch;
+import org.sonar.core.util.stream.MoreCollectors;
 import org.sonar.db.component.SnapshotDto;
 import org.sonar.scanner.protocol.output.ScannerReport;
 import org.sonar.scanner.protocol.output.ScannerReport.Component.FileStatus;
-import org.sonar.ce.task.projectanalysis.analysis.Branch;
 import org.sonar.server.project.Project;
 
 import static com.google.common.base.MoreObjects.firstNonNull;
@@ -88,7 +88,7 @@ public class ComponentTreeBuilder {
       .stream()
       .map(scannerComponentSupplier::apply)
       .map(c -> buildComponent(c, parentModule, projectScmPath))
-      .collect(Collectors.toList());
+      .collect(MoreCollectors.toList(component.getChildRefCount()));
   }
 
   private ComponentImpl buildComponent(ScannerReport.Component component, ScannerReport.Component closestModule,