From: Léo Geoffroy Date: Wed, 8 Nov 2023 14:37:42 +0000 (+0100) Subject: NO-JIRA Fix code smells X-Git-Tag: 10.4.0.87286~500 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ee8c68b568d9ae669d54ebef4e63de0bb72f7493;p=sonarqube.git NO-JIRA Fix code smells --- 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();