From c94f82925f5ce0664b3e681f1db6fdb52c5c9263 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Mon, 22 Aug 2016 12:30:44 +0200 Subject: [PATCH] Fix some quality flaws --- .../main/java/org/sonar/scanner/scan/report/JSONReport.java | 5 ++--- 1 file 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 1661d591a0d..05cc7f08717 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 @@ -100,9 +100,8 @@ public class JSONReport implements Reporter { File exportFile = new File(fileSystem.workDir(), exportPath); LOG.info("Export issues to {}", exportFile.getAbsolutePath()); - try (Writer output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(exportFile), StandardCharsets.UTF_8))) { - writeJson(output); - + try (FileOutputStream fos = new FileOutputStream(exportFile)) { + writeJson(new BufferedWriter(new OutputStreamWriter(fos, StandardCharsets.UTF_8))); } catch (IOException e) { throw new IllegalStateException("Unable to write report results in file " + exportFile.getAbsolutePath(), e); } -- 2.39.5