You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/11/21 15:45:04 UTC

[commons-jcs] branch master updated: Use try-with-resource.

This is an automated email from the ASF dual-hosted git repository.

ggregory 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 8194dca  Use try-with-resource.
8194dca is described below

commit 8194dca422a80ae03eec3abea53612813ea03ce2
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 21 10:45:00 2020 -0500

    Use try-with-resource.
---
 .../apache/commons/jcs3/jcache/extras/InternalCacheRule.java   | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/commons-jcs-jcache-extras/src/test/java/org/apache/commons/jcs3/jcache/extras/InternalCacheRule.java b/commons-jcs-jcache-extras/src/test/java/org/apache/commons/jcs3/jcache/extras/InternalCacheRule.java
index cc34f97..16de39a 100644
--- a/commons-jcs-jcache-extras/src/test/java/org/apache/commons/jcs3/jcache/extras/InternalCacheRule.java
+++ b/commons-jcs-jcache-extras/src/test/java/org/apache/commons/jcs3/jcache/extras/InternalCacheRule.java
@@ -48,9 +48,8 @@ public class InternalCacheRule implements TestRule
             @Override
             public void evaluate() throws Throwable
             {
-                final CachingProvider provider = Caching.getCachingProvider();
-                final CacheManager manager = provider.getCacheManager();
-                try
+                try (CachingProvider provider = Caching.getCachingProvider();
+                        CacheManager manager = provider.getCacheManager())
                 {
                     Field cache = null;
                     CompleteConfiguration<?, ?> config = null;
@@ -77,11 +76,6 @@ public class InternalCacheRule implements TestRule
                     }
                     base.evaluate();
                 }
-                finally
-                {
-                    manager.close();
-                    provider.close();
-                }
             }
         };
     }