From ee8c68b568d9ae669d54ebef4e63de0bb72f7493 Mon Sep 17 00:00:00 2001 From: =?utf8?q?L=C3=A9o=20Geoffroy?= Date: Wed, 8 Nov 2023 15:37:42 +0100 Subject: [PATCH] NO-JIRA Fix code smells --- .../src/main/java/org/sonar/db/issue/IndexedIssueDto.java | 2 -- .../java/org/sonar/server/measure/ws/ComponentAction.java | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IndexedIssueDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IndexedIssueDto.java index 19a09614911..f4e2d67cb79 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IndexedIssueDto.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IndexedIssueDto.java @@ -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; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentAction.java index ecff082cf82..fd1783a5b46 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentAction.java @@ -154,8 +154,7 @@ public class ComponentAction implements MeasuresWsAction { Map 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 measuresByMetric, Collection metrics, @Nullable Measures.Period period, Collection requestedMetrics) { + ComponentWsResponse.Builder response = ComponentWsResponse.newBuilder(); + RefComponent reference = getReference(dbSession, component).orElse(null); if (reference != null) { BranchDto refBranch = reference.getRefBranch(); ComponentDto refComponent = reference.getComponent(); -- 2.39.5