aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-scanner-engine')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/JSONReport.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/JSONReport.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/JSONReport.java
index 68c2c20f9b2..fdaaefa2e19 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/JSONReport.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/JSONReport.java
@@ -109,8 +109,7 @@ public class JSONReport implements Reporter {
@VisibleForTesting
void writeJson(Writer writer) {
- try {
- JsonWriter json = JsonWriter.of(writer);
+ try (JsonWriter json = JsonWriter.of(writer)) {
json.beginObject();
json.prop("version", server.getVersion());
@@ -120,7 +119,7 @@ public class JSONReport implements Reporter {
writeJsonComponents(json);
writeJsonRules(json, ruleKeys);
writeUsers(json, userLogins);
- json.endObject().close();
+ json.endObject();
} catch (IOException e) {
throw new IllegalStateException("Unable to write JSON report", e);