Stream handling simplification in PropertiesUtil

- use resource block instead of finally block

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
This commit is contained in:
Laszlo Hornyak 2014-02-26 21:40:11 +01:00
parent 71bb436c8d
commit ca9dd457f9

View File

@ -168,12 +168,11 @@ public class PropertiesUtil {
* @param file the file to load from * @param file the file to load from
* @throws IOException * @throws IOException
*/ */
public static void loadFromFile(Properties properties, File file) throws IOException { public static void loadFromFile(final Properties properties, final File file)
InputStream stream = new FileInputStream(file); throws IOException {
try { try (final InputStream stream = new FileInputStream(file)) {
properties.load(stream); properties.load(stream);
} finally {
IOUtils.closeQuietly(stream);
} }
} }
} }