]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9441 WS api/custom_measures/metrics fails properly when no parameter is provided
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Tue, 20 Jun 2017 12:24:39 +0000 (14:24 +0200)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Tue, 20 Jun 2017 13:16:02 +0000 (15:16 +0200)
server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/MetricsAction.java

index ff9d65d137c681f272b224cf5fa2b1bc8cd6bfd1..e861eab5306e73edfe881d2fa14638a736ce771f 100644 (file)
@@ -80,11 +80,12 @@ public class MetricsAction implements CustomMeasuresWsAction {
       checkPermissions(userSession, project);
       List<MetricDto> metrics = searchMetrics(dbSession, project);
 
-      writeResponse(response.newJsonWriter(), metrics);
+      writeResponse(response, metrics);
     }
   }
 
-  private static void writeResponse(JsonWriter json, List<MetricDto> metrics) {
+  private static void writeResponse(Response response, List<MetricDto> metrics) {
+    JsonWriter json = response.newJsonWriter();
     json.beginObject();
     MetricJsonWriter.write(json, metrics, MetricJsonWriter.ALL_FIELDS);
     json.endObject();