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 2024/05/17 18:32:43 UTC

(commons-compress) 02/06: Use try-with-resources

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

commit 13b6fbacda935c8aae98ad9cef98fe9d7a1feda4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri May 17 14:00:44 2024 -0400

    Use try-with-resources
    
    Internal refactoring
---
 .../commons/compress/archivers/tar/TarArchiveInputStreamTest.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
index 50b02c1fd..8ad695beb 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
@@ -151,8 +151,8 @@ public class TarArchiveInputStreamTest extends AbstractTest {
             // tar these dirs
             final String fileName = "/" + dirDirectory + "/" + subDir;
             final File tarF = new File(rootPath + "/tar" + i + ".tar");
-            try (OutputStream dest = Files.newOutputStream(tarF.toPath())) {
-                final TarArchiveOutputStream out = new TarArchiveOutputStream(new BufferedOutputStream(dest));
+            try (OutputStream dest = Files.newOutputStream(tarF.toPath());
+                    TarArchiveOutputStream out = new TarArchiveOutputStream(new BufferedOutputStream(dest))) {
                 out.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_STAR);
                 out.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);