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 308c1bf01af1ff4744682fbf6d7b73f4ab90f870 Author: Gary Gregory <[email protected]> AuthorDate: Mon Aug 10 17:42:33 2026 -0400 ArjArchiveInputStream now throws ArchiveException instead of IllegalArgumentException. --- src/changes/changes.xml | 1 + .../apache/commons/compress/archivers/arj/ArjArchiveInputStream.java | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 8d48cbc2f..e1485cf61 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -113,6 +113,7 @@ The <action> type attribute can be add,update,fix,remove. <action type="fix" dev="pkarwasz" due-to="Piotr P. Karwasz">Correct byte accounting and truncation errors in ARJ input stream.</action> <action type="fix" dev="pkarwasz" due-to="Piotr P. Karwasz">Add strict header validation in ARJ input stream and `selfExtracting` option.</action> <action type="fix" dev="ggregory" due-to="KALI 834X, Gary Gregory">Reject missing main header in ArjArchiveInputStream.readMainHeader (#793).</action> + <action type="fix" dev="ggregory" due-to="Gary Gregory">ArjArchiveInputStream now throws ArchiveException instead of IllegalArgumentException.</action> <!-- FIX unpack200 --> <action type="fix" dev="ggregory" due-to="Gary Gregory, Stanislav Fort">org.apache.commons.compress.harmony.unpack200 now throws Pack200Exception, IllegalArgumentException, and IllegalStateException instead of other runtime exceptions and Error.</action> <action type="fix" dev="pkarwasz" due-to="Piotr P. Karwasz">Enforce strict attribute layout parsing in Pack200.</action> diff --git a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java index 4f7d345aa..3841344aa 100644 --- a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java +++ b/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java @@ -311,9 +311,7 @@ public int read(final byte[] b, final int off, final int len) throws IOException if (len == 0) { return 0; } - if (currentLocalFileHeader == null) { - throw new IllegalStateException("No current arj entry"); - } + ArchiveException.requireNonNull(currentLocalFileHeader, "No current arj entry"); if (currentLocalFileHeader.method != LocalFileHeader.Methods.STORED) { throw new ArchiveException("Unsupported compression method '%s'", currentLocalFileHeader.method); }
