From e8488c8588a7928c05949bfce2c1be6459aaa5f0 Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Tue, 20 Jun 2017 14:24:39 +0200 Subject: [PATCH] SONAR-9441 WS api/custom_measures/metrics fails properly when no parameter is provided --- .../org/sonar/server/measure/custom/ws/MetricsAction.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/MetricsAction.java b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/MetricsAction.java index ff9d65d137c..e861eab5306 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/MetricsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/MetricsAction.java @@ -80,11 +80,12 @@ public class MetricsAction implements CustomMeasuresWsAction { checkPermissions(userSession, project); List metrics = searchMetrics(dbSession, project); - writeResponse(response.newJsonWriter(), metrics); + writeResponse(response, metrics); } } - private static void writeResponse(JsonWriter json, List metrics) { + private static void writeResponse(Response response, List metrics) { + JsonWriter json = response.newJsonWriter(); json.beginObject(); MetricJsonWriter.write(json, metrics, MetricJsonWriter.ALL_FIELDS); json.endObject(); -- 2.39.5