mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
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:
parent
71bb436c8d
commit
ca9dd457f9
@ -168,12 +168,11 @@ public class PropertiesUtil {
|
||||
* @param file the file to load from
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void loadFromFile(Properties properties, File file) throws IOException {
|
||||
InputStream stream = new FileInputStream(file);
|
||||
try {
|
||||
public static void loadFromFile(final Properties properties, final File file)
|
||||
throws IOException {
|
||||
try (final InputStream stream = new FileInputStream(file)) {
|
||||
properties.load(stream);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(stream);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user