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-compress.git


The following commit(s) were added to refs/heads/master by this push:
     new 77e4b05f6 Refactor ArchiveTest teardown
77e4b05f6 is described below

commit 77e4b05f62a24c5ee6f05bd8d95ea65036f38cf0
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Fri Mar 29 15:30:26 2024 -0400

    Refactor ArchiveTest teardown
---
 .../commons/compress/harmony/unpack200/ArchiveTest.java | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/compress/harmony/unpack200/ArchiveTest.java 
b/src/test/java/org/apache/commons/compress/harmony/unpack200/ArchiveTest.java
index fc8372b98..67d983300 100644
--- 
a/src/test/java/org/apache/commons/compress/harmony/unpack200/ArchiveTest.java
+++ 
b/src/test/java/org/apache/commons/compress/harmony/unpack200/ArchiveTest.java
@@ -40,6 +40,7 @@ import java.util.jar.JarOutputStream;
 import java.util.zip.ZipEntry;
 
 import org.apache.commons.compress.AbstractTempDirTest;
+import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.input.BoundedInputStream;
 import org.apache.commons.io.output.NullOutputStream;
 import org.junit.jupiter.api.AfterEach;
@@ -57,20 +58,8 @@ public class ArchiveTest extends AbstractTempDirTest {
 
     @AfterEach
     public void tearDown() throws Exception {
-        if (in != null) {
-            try {
-                in.close();
-            } catch (final IOException e) {
-                e.printStackTrace();
-            }
-        }
-        try {
-            if (out != null) {
-                out.close();
-            }
-        } catch (final IOException e) {
-            e.printStackTrace();
-        }
+        IOUtils.closeQuietly(in, IOException::printStackTrace);
+        IOUtils.closeQuietly(out, IOException::printStackTrace);
     }
 
     @Test

Reply via email to