From 983c550c085539c485e03119644984cb9fecc880 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Tue, 6 Jan 2015 23:18:38 +0100 Subject: Fix quality flaws --- .../src/main/java/org/sonar/application/PropsBuilder.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'sonar-application/src') diff --git a/sonar-application/src/main/java/org/sonar/application/PropsBuilder.java b/sonar-application/src/main/java/org/sonar/application/PropsBuilder.java index 1873448fb96..652dd4cf814 100644 --- a/sonar-application/src/main/java/org/sonar/application/PropsBuilder.java +++ b/sonar-application/src/main/java/org/sonar/application/PropsBuilder.java @@ -19,15 +19,17 @@ */ package org.sonar.application; +import org.apache.commons.io.Charsets; import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; import org.sonar.process.ConfigurationUtils; import org.sonar.process.ProcessConstants; import org.sonar.process.Props; import java.io.File; -import java.io.FileReader; +import java.io.FileInputStream; import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; import java.net.URISyntaxException; import java.util.Properties; @@ -84,11 +86,8 @@ class PropsBuilder { Properties p = new Properties(); File propsFile = new File(homeDir, "conf/sonar.properties"); if (propsFile.exists()) { - FileReader reader = new FileReader(propsFile); - try { + try (Reader reader = new InputStreamReader(new FileInputStream(propsFile), Charsets.UTF_8)) { p.load(reader); - } finally { - IOUtils.closeQuietly(reader); } } return p; -- cgit v1.2.3