Change this "try" to a try-with-resources
Closes gh-1671
This commit is contained in:
committed by
Stephane Nicoll
parent
909cacec42
commit
c0b4b5787f
@@ -249,8 +249,7 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
|
||||
|
||||
Properties props = new Properties();
|
||||
try {
|
||||
InputStream is = encodedResource.getResource().getInputStream();
|
||||
try {
|
||||
try (InputStream is = encodedResource.getResource().getInputStream()) {
|
||||
if (encodedResource.getEncoding() != null) {
|
||||
getPropertiesPersister().load(props, new InputStreamReader(is, encodedResource.getEncoding()));
|
||||
}
|
||||
@@ -258,9 +257,6 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
|
||||
getPropertiesPersister().load(props, is);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
is.close();
|
||||
}
|
||||
return registerBeanDefinitions(props, prefix, encodedResource.getResource().getDescription());
|
||||
}
|
||||
catch (IOException ex) {
|
||||
|
||||
Reference in New Issue
Block a user