From 5721c747b26665ccf1afb5e823b9774be2bffbcf Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 21 Apr 2020 18:47:28 +0200 Subject: [PATCH] Polishing --- .../core/io/support/PropertiesLoaderUtils.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderUtils.java b/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderUtils.java index 256cee84ef..6efa78f3da 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderUtils.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderUtils.java @@ -130,8 +130,7 @@ public abstract class PropertiesLoaderUtils { * @throws IOException if loading failed */ public static void fillProperties(Properties props, Resource resource) throws IOException { - InputStream is = resource.getInputStream(); - try { + try (InputStream is = resource.getInputStream()) { String filename = resource.getFilename(); if (filename != null && filename.endsWith(XML_FILE_EXTENSION)) { props.loadFromXML(is); @@ -140,9 +139,6 @@ public abstract class PropertiesLoaderUtils { props.load(is); } } - finally { - is.close(); - } } /**