mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +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
|
* @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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user