Change this "try" to a try-with-resources

Closes gh-1671
This commit is contained in:
igor-suhorukov
2018-02-09 01:00:24 +03:00
committed by Stephane Nicoll
parent 909cacec42
commit c0b4b5787f
5 changed files with 15 additions and 37 deletions

View File

@@ -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) {