]> source.dussan.org Git - sonarqube.git/commitdiff
NO-JIRA Fix code smells
authorLéo Geoffroy <leo.geoffroy@sonarsource.com>
Wed, 8 Nov 2023 14:37:42 +0000 (15:37 +0100)
committersonartech <sonartech@sonarsource.com>
Wed, 8 Nov 2023 20:02:54 +0000 (20:02 +0000)
server/sonar-db-dao/src/main/java/org/sonar/db/issue/IndexedIssueDto.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentAction.java

index 19a0961491109bc496548accf7448b1106d697a1..f4e2d67cb792a25588768d3c2b24e505a6ccbb1a 100644 (file)
@@ -30,8 +30,6 @@ import org.sonar.api.issue.impact.Severity;
 import org.sonar.api.issue.impact.SoftwareQuality;
 import org.sonar.core.issue.status.IssueStatus;
 
-import static com.google.common.base.Preconditions.checkArgument;
-
 public final class IndexedIssueDto {
   private String issueKey = null;
   private String assignee = null;
index ecff082cf82b6f6d0ecf260e55fc28cc7b840d43..fd1783a5b4611cf0991957c9c6ee61d310215db6 100644 (file)
@@ -154,8 +154,7 @@ public class ComponentAction implements MeasuresWsAction {
       Map<MetricDto, LiveMeasureDto> measuresByMetric = getMeasuresByMetric(measures, metrics);
 
       Measures.Period period = snapshotToWsPeriods(analysis).orElse(null);
-      RefComponent reference = getReference(dbSession, component).orElse(null);
-      return buildResponse(dbSession, request, component, reference, measuresByMetric, metrics, period, request.getMetricKeys());
+      return buildResponse(dbSession, request, component, measuresByMetric, metrics, period, request.getMetricKeys());
     }
   }
 
@@ -232,11 +231,13 @@ public class ComponentAction implements MeasuresWsAction {
     return refBranch.map(rb -> new RefComponent(rb, refComponent.get()));
   }
 
-  private ComponentWsResponse buildResponse(DbSession dbSession, ComponentRequest request, ComponentDto component, @Nullable RefComponent reference,
+  private ComponentWsResponse buildResponse(DbSession dbSession, ComponentRequest request, ComponentDto component,
     Map<MetricDto, LiveMeasureDto> measuresByMetric, Collection<MetricDto> metrics, @Nullable Measures.Period period,
     Collection<String> requestedMetrics) {
+
     ComponentWsResponse.Builder response = ComponentWsResponse.newBuilder();
 
+    RefComponent reference = getReference(dbSession, component).orElse(null);
     if (reference != null) {
       BranchDto refBranch = reference.getRefBranch();
       ComponentDto refComponent = reference.getComponent();