properly close reader

This commit is contained in:
Xavier Léauté 2014-09-15 12:17:45 -07:00
parent c8b8e3f6e9
commit 0c35fe2cf4
1 changed files with 3 additions and 2 deletions

View File

@ -33,6 +33,7 @@ import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.Reader;
import java.util.Properties; import java.util.Properties;
/** /**
@ -68,8 +69,8 @@ public class PropertiesModule implements Module
if (stream != null) { if (stream != null) {
log.info("Loading properties from %s", propertiesFile); log.info("Loading properties from %s", propertiesFile);
try { try(Reader reader = new InputStreamReader(stream, Charsets.UTF_8)) {
fileProps.load(new InputStreamReader(stream, Charsets.UTF_8)); fileProps.load(reader);
} }
catch (IOException e) { catch (IOException e) {
throw Throwables.propagate(e); throw Throwables.propagate(e);