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 4a6079b34d57513ef3d38098e134396c45ded2e8
Author: Gary Gregory <[email protected]>
AuthorDate: Thu Dec 11 17:45:39 2025 -0500

    Use IOUtils.close(...)
---
 .../java/org/apache/commons/compress/archivers/tar/TarFile.java    | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java 
b/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java
index 0612626ed..c1dc46bc2 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java
@@ -42,6 +42,7 @@
 import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
 import org.apache.commons.compress.utils.ArchiveUtils;
 import org.apache.commons.compress.utils.BoundedArchiveInputStream;
+import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.function.IOStream;
 import org.apache.commons.io.input.BoundedInputStream;
 
@@ -192,11 +193,7 @@ private TarFile(final Builder builder) throws IOException {
                 entries.add(entry);
             }
         } catch (final IOException ex) {
-            try {
-                this.archive.close();
-            } catch (final IOException e) {
-                ex.addSuppressed(e);
-            }
+            IOUtils.close(archive, ex::addSuppressed);
             throw ex;
         }
     }

Reply via email to