You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2018/05/11 19:50:06 UTC

[2/3] commons-compress git commit: don't leak resources

don't leak resources


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/63eeef3e
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/63eeef3e
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/63eeef3e

Branch: refs/heads/master
Commit: 63eeef3e0ea511229fd3417b7863e8c709cca2fb
Parents: 2544a0c
Author: Stefan Bodewig <bo...@apache.org>
Authored: Fri May 11 21:45:49 2018 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Fri May 11 21:45:49 2018 +0200

----------------------------------------------------------------------
 .../commons/compress/archivers/examples/ExpanderTest.java    | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/63eeef3e/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java b/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java
index a579261..4fbc394 100644
--- a/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java
@@ -92,14 +92,18 @@ public class ExpanderTest extends AbstractTestCase {
     @Test
     public void sevenZFileVersion() throws IOException, ArchiveException {
         setup7z();
-        new Expander().expand(new SevenZFile(archive), resultDir);
+        try (SevenZFile f = new SevenZFile(archive)) {
+            new Expander().expand(f, resultDir);
+        }
         verifyTargetDir();
     }
 
     @Test
     public void zipFileVersion() throws IOException, ArchiveException {
         setupZip();
-        new Expander().expand(new ZipFile(archive), resultDir);
+        try (ZipFile f = new ZipFile(archive)) {
+            new Expander().expand(f, resultDir);
+        }
         verifyTargetDir();
     }