From: Teryk Bellahsene Date: Tue, 20 Jun 2017 12:24:39 +0000 (+0200) Subject: SONAR-9441 WS api/custom_measures/metrics fails properly when no parameter is provided X-Git-Tag: 6.5-M2~112 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e8488c8588a7928c05949bfce2c1be6459aaa5f0;p=sonarqube.git SONAR-9441 WS api/custom_measures/metrics fails properly when no parameter is provided --- 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();