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 2026/08/10 22:11:16 UTC

(commons-compress) 10/10: TapeInputStream now throws ArchiveException instead of IllegalArgumentException.

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 daf142e96f8ef9e39e725d164c5a0ad2de2bf14e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Aug 10 18:10:59 2026 -0400

    TapeInputStream now throws ArchiveException instead of
    IllegalArgumentException.
---
 src/changes/changes.xml                                             | 1 +
 .../org/apache/commons/compress/archivers/dump/TapeInputStream.java | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a94e2bca8..dc99f81ce 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -74,6 +74,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Philip Betzler-Braun, Gary Gregory, Piotr P. Karwasz" issue="COMPRESS-712">Unsanitized read causes IndexOutOfBoundsException in #749.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory, KALI 834X">DumpArchiveEntry rejects out-of-range directory header count (#781).</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">DumpArchiveInputStream now throws ArchiveException instead of IllegalArgumentException.</action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">TapeArchiveInputStream now throws ArchiveException instead of IllegalArgumentException.</action>
       <!-- FIX zip -->
       <action type="fix" dev="ggregory" due-to="Dominik Stadler, Gary Gregory" issue="COMPRESS-598">ZipArchiveInputStream.read(byte[], int, int) now throws an IOException instead of a NullPointerException.</action>
       <action type="fix" dev="ggregory" due-to="Tyler Nighswander, Gary Gregory">ZipFile.createBoundedInputStream(long, long) now throws an ArchiveException instead of IllegalArgumentException.</action>
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java b/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
index 91754166a..172f22f87 100644
--- a/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
@@ -116,7 +116,7 @@ public byte[] peek() throws IOException {
      */
     @Override
     public int read() throws IOException {
-        throw new IllegalArgumentException("All reads must be multiple of record size (" + RECORD_SIZE + " bytes.");
+        throw new ArchiveException("All reads must be multiple of record size (" + RECORD_SIZE + " bytes.");
     }
 
     /**
@@ -135,7 +135,7 @@ public int read(final byte[] b, int off, final int len) throws IOException {
             return 0;
         }
         if (len % RECORD_SIZE != 0) {
-            throw new IllegalArgumentException("All reads must be multiple of record size (" + RECORD_SIZE + " bytes.");
+            throw new ArchiveException("All reads must be multiple of record size (" + RECORD_SIZE + " bytes.");
         }
         int bytes = 0;
         while (bytes < len) {
@@ -313,7 +313,7 @@ void resetBlockSize(final int recsPerBlock, final boolean isCompressed) throws I
     @Override
     public long skip(final long len) throws IOException {
         if (len % RECORD_SIZE != 0) {
-            throw new IllegalArgumentException("All reads must be multiple of record size (" + RECORD_SIZE + " bytes.");
+            throw new ArchiveException("All reads must be multiple of record size (" + RECORD_SIZE + " bytes.");
         }
         long bytes = 0;
         while (bytes < len) {