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

garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git

commit 599d2ab6905d0708862df6328983dbad33c00f6e
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Aug 9 19:00:02 2026 -0400

    TAR private methods now throws the IOException subclass
    CompressException.
---
 .../commons/compress/archivers/ar/ArArchiveInputStream.java      | 9 +++++----
 .../apache/commons/compress/archivers/tar/TarArchiveEntry.java   | 9 +++++----
 .../java/org/apache/commons/compress/utils/ParsingUtilsTest.java | 7 +++----
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
 
b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
index b25c71640..9dc07d1de 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
@@ -25,6 +25,7 @@
 import java.util.Arrays;
 import java.util.regex.Pattern;
 
+import org.apache.commons.compress.CompressException;
 import org.apache.commons.compress.MemoryLimitException;
 import org.apache.commons.compress.archivers.AbstractArchiveBuilder;
 import org.apache.commons.compress.archivers.ArchiveException;
@@ -186,15 +187,15 @@ public ArArchiveInputStream(final InputStream 
inputStream) throws IOException {
         this(builder().setInputStream(inputStream));
     }
 
-    private int asInt(final byte[] byteArray, final int offset, final int len, 
final boolean treatBlankAsZero) throws IOException {
+    private int asInt(final byte[] byteArray, final int offset, final int len, 
final boolean treatBlankAsZero) throws CompressException {
         return asInt(byteArray, offset, len, 10, treatBlankAsZero);
     }
 
-    private int asInt(final byte[] byteArray, final int offset, final int len, 
final int base) throws IOException {
+    private int asInt(final byte[] byteArray, final int offset, final int len, 
final int base) throws CompressException {
         return asInt(byteArray, offset, len, base, false);
     }
 
-    private int asInt(final byte[] byteArray, final int offset, final int len, 
final int base, final boolean treatBlankAsZero) throws IOException {
+    private int asInt(final byte[] byteArray, final int offset, final int len, 
final int base, final boolean treatBlankAsZero) throws CompressException {
         final String string = ArchiveUtils.toAsciiString(byteArray, offset, 
len).trim();
         if (string.isEmpty() && treatBlankAsZero) {
             return 0;
@@ -202,7 +203,7 @@ private int asInt(final byte[] byteArray, final int offset, 
final int len, final
         return ParsingUtils.parseIntValue(string, base);
     }
 
-    private long asLong(final byte[] byteArray, final int offset, final int 
len) throws IOException {
+    private long asLong(final byte[] byteArray, final int offset, final int 
len) throws CompressException {
         return 
ParsingUtils.parseLongValue(ArchiveUtils.toAsciiString(byteArray, offset, 
len).trim());
     }
 
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java 
b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
index 335c66c73..25eb5658a 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
@@ -46,6 +46,7 @@
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
+import org.apache.commons.compress.CompressException;
 import org.apache.commons.compress.archivers.ArchiveEntry;
 import org.apache.commons.compress.archivers.ArchiveException;
 import org.apache.commons.compress.archivers.EntryStreamOffsets;
@@ -764,7 +765,7 @@ private int fill(final int value, final int offset, final 
byte[] outbuf, final i
         return fill((byte) value, offset, outbuf, length);
     }
 
-    void fillGNUSparse0xData(final Map<String, String> headers) throws 
IOException {
+    void fillGNUSparse0xData(final Map<String, String> headers) throws 
CompressException {
         paxGNUSparse = true;
         realSize = 
ParsingUtils.parseIntValue(headers.get(TarGnuSparseKeys.SIZE));
         if (headers.containsKey(TarGnuSparseKeys.NAME)) {
@@ -773,7 +774,7 @@ void fillGNUSparse0xData(final Map<String, String> headers) 
throws IOException {
         }
     }
 
-    void fillGNUSparse1xData(final Map<String, String> headers) throws 
IOException {
+    void fillGNUSparse1xData(final Map<String, String> headers) throws 
CompressException {
         paxGNUSparse = true;
         paxGNU1XSparse = true;
         if (headers.containsKey(TarGnuSparseKeys.NAME)) {
@@ -784,7 +785,7 @@ void fillGNUSparse1xData(final Map<String, String> headers) 
throws IOException {
         }
     }
 
-    void fillStarSparseData(final Map<String, String> headers) throws 
IOException {
+    void fillStarSparseData(final Map<String, String> headers) throws 
CompressException {
         starSparse = true;
         if (headers.containsKey(SCHILY_REALSIZE)) {
             realSize = 
ParsingUtils.parseLongValue(headers.get(SCHILY_REALSIZE));
@@ -1632,7 +1633,7 @@ private void processPaxHeader(final String key, final 
String val) throws IOExcep
      * @throws IOException if encountered errors when parsing the numbers.
      * @since 1.15
      */
-    private void processPaxHeader(final String key, final String val, final 
Map<String, String> headers) throws IOException {
+    private void processPaxHeader(final String key, final String val, final 
Map<String, String> headers) throws CompressException {
         /*
          * The following headers are defined for PAX. charset: cannot use 
these without changing TarArchiveEntry fields mtime atime ctime
          * LIBARCHIVE.creationtime comment gid, gname linkpath size uid,uname 
SCHILY.devminor, SCHILY.devmajor: don't have setters/getters for those
diff --git 
a/src/test/java/org/apache/commons/compress/utils/ParsingUtilsTest.java 
b/src/test/java/org/apache/commons/compress/utils/ParsingUtilsTest.java
index 093a6ac4c..3626d455e 100644
--- a/src/test/java/org/apache/commons/compress/utils/ParsingUtilsTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/ParsingUtilsTest.java
@@ -22,8 +22,7 @@
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
-import java.io.IOException;
-
+import org.apache.commons.compress.CompressException;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
 
@@ -37,7 +36,7 @@ class ParsingUtilsTest {
     @ParameterizedTest
     @ValueSource(strings = {Integer.MIN_VALUE + "1", "x.x", "9e999", "1.1", 
"one", Integer.MAX_VALUE + "1"})
     void testParseIntValueInvalidValues(final String value) {
-        assertThrows(IOException.class, () -> 
ParsingUtils.parseIntValue(value, 10));
+        assertThrows(CompressException.class, () -> 
ParsingUtils.parseIntValue(value, 10));
     }
 
     @ParameterizedTest
@@ -49,7 +48,7 @@ void testParseIntValueValidValues(final String value) throws 
Exception {
     @ParameterizedTest
     @ValueSource(strings = {Long.MIN_VALUE + "1", "x.x", "9e999", "1.1", 
"one", Long.MAX_VALUE + "1"})
     void testParseLongValueInvalidValues(final String value) {
-        assertThrows(IOException.class, () -> 
ParsingUtils.parseLongValue(value, 10));
+        assertThrows(CompressException.class, () -> 
ParsingUtils.parseLongValue(value, 10));
     }
 
     @ParameterizedTest

Reply via email to