This is an automated email from the ASF dual-hosted git repository.
tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git
The following commit(s) were added to refs/heads/master by this push:
new 8ead8e3 Use try-with-resources statement
new 6c8b7c5 Merge pull request #45 from
arturobernalg/feature/trywithresources
8ead8e3 is described below
commit 8ead8e38218a8623298dca1e7f52354bb82f5d17
Author: Arturo Bernal <[email protected]>
AuthorDate: Tue Mar 30 07:08:11 2021 +0200
Use try-with-resources statement
---
.../commons/jcs3/jcache/JCSCachingManager.java | 23 ++--------------------
1 file changed, 2 insertions(+), 21 deletions(-)
diff --git
a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCachingManager.java
b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCachingManager.java
index 62690ed..90ec8f0 100644
---
a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCachingManager.java
+++
b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCachingManager.java
@@ -166,30 +166,11 @@ public class JCSCachingManager implements CacheManager
private void addProperties(final URL url, final Properties aggregator)
{
- InputStream inStream = null;
- try
- {
- inStream = url.openStream();
+ try (InputStream inStream = url.openStream()) {
aggregator.load(inStream);
- }
- catch (final IOException e)
- {
+ } catch (final IOException e) {
throw new IllegalArgumentException(e);
}
- finally
- {
- if (inStream != null)
- {
- try
- {
- inStream.close();
- }
- catch (final IOException e)
- {
- // no-op
- }
- }
- }
}
private void assertNotClosed()