Skip to content

Commit 5721c74

Browse files
committed
Polishing
1 parent 31fa156 commit 5721c74

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderUtils.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ public static Properties loadProperties(Resource resource) throws IOException {
130130
* @throws IOException if loading failed
131131
*/
132132
public static void fillProperties(Properties props, Resource resource) throws IOException {
133-
InputStream is = resource.getInputStream();
134-
try {
133+
try (InputStream is = resource.getInputStream()) {
135134
String filename = resource.getFilename();
136135
if (filename != null && filename.endsWith(XML_FILE_EXTENSION)) {
137136
props.loadFromXML(is);
@@ -140,9 +139,6 @@ public static void fillProperties(Properties props, Resource resource) throws IO
140139
props.load(is);
141140
}
142141
}
143-
finally {
144-
is.close();
145-
}
146142
}
147143

148144
/**

0 commit comments

Comments
 (0)