Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/impl/config/StandardLoggingConfiguration.java21
1 files changed, 5 insertions, 16 deletions
diff --git a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/impl/config/StandardLoggingConfiguration.java b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/impl/config/StandardLoggingConfiguration.java
index 7e74f91..49d4c57 100644
--- a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/impl/config/StandardLoggingConfiguration.java
+++ b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/impl/config/StandardLoggingConfiguration.java
@@ -11,16 +11,17 @@
package org.eclipse.virgo.medic.log.impl.config;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.BufferedReader;
import java.io.File;
-import java.io.FileReader;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import org.eclipse.virgo.medic.log.LoggingConfiguration;
-
class StandardLoggingConfiguration implements LoggingConfiguration {
private final String configuration;
@@ -49,26 +50,14 @@ class StandardLoggingConfiguration implements LoggingConfiguration {
}
private static String readConfiguration(URL configURL) throws IOException {
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new InputStreamReader(configURL.openStream()));
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(configURL.openStream(), UTF_8))) {
return readConfiguration(reader);
- } finally {
- if (reader != null) {
- reader.close();
- }
}
}
private static String readConfiguration(File configFile) throws IOException {
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new FileReader(configFile));
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), UTF_8))) {
return readConfiguration(reader);
- } finally {
- if (reader != null) {
- reader.close();
- }
}
}

Back to the top