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


The following commit(s) were added to refs/heads/master by this push:
     new 5d39bfe7d Add 
org.apache.commons.compress.compressors.pack200.Pack200CompressorInputStreamTest.testBandSet_decodeBandInt()
5d39bfe7d is described below

commit 5d39bfe7d8d7f7be48bca55010ff991cf9ffb193
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Mon Aug 25 18:05:18 2025 -0400

    Add 
org.apache.commons.compress.compressors.pack200.Pack200CompressorInputStreamTest.testBandSet_decodeBandInt()
---
 .../harmony/unpack200/Pack200UnpackerAdapter.java         |  2 +-
 .../pack200/Pack200CompressorInputStreamTest.java         | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/commons/compress/harmony/unpack200/Pack200UnpackerAdapter.java
 
b/src/main/java/org/apache/commons/compress/harmony/unpack200/Pack200UnpackerAdapter.java
index 0e5f107da..d8c09208b 100644
--- 
a/src/main/java/org/apache/commons/compress/harmony/unpack200/Pack200UnpackerAdapter.java
+++ 
b/src/main/java/org/apache/commons/compress/harmony/unpack200/Pack200UnpackerAdapter.java
@@ -194,7 +194,7 @@ public void unpack(final InputStream in, final 
JarOutputStream out) throws IOExc
         try {
             new Archive(in, out).unpack();
         } catch (final Pack200Exception | RuntimeException e) {
-            throw new IOException("Failed to unpack Jar:" + e);
+            throw new IOException("Failed to unpack JAR: " + e, e);
         }
         completed(1);
     }
diff --git 
a/src/test/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStreamTest.java
 
b/src/test/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStreamTest.java
index 1192bd7ed..98c6b025c 100644
--- 
a/src/test/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStreamTest.java
+++ 
b/src/test/java/org/apache/commons/compress/compressors/pack200/Pack200CompressorInputStreamTest.java
@@ -34,6 +34,21 @@ public class Pack200CompressorInputStreamTest {
 
     /*
      * Bad input detected in 
org.apache.commons.compress.harmony.unpack200.CpBands.parseCpUtf8(InputStream).
+     *
+     * An {@link IOException} wraps an {@link ArrayIndexOutOfBoundsException}.
+     */
+    @Test
+    public void testBandSet_decodeBandInt() throws IOException {
+        final byte[] input = 
Base64.getDecoder().decode("yv7QDQeWZxAEDXNJEBAuEBAQAQAAAABDAIAQEC8Q7RAQEPYAAAD/////ARAQCgoKCgo0CgoKCgoKCgoKCgoKJwAAAAoKLf4"
+                + 
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEAcQQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAPD+/v7+/v7+/v7+"
+                + "/v7+/v7+/////wEAAAAAAAAAAAAAAAAQ//7+JZAoDQc=");
+        assertThrows(IOException.class, () -> new 
Pack200CompressorInputStream(new ByteArrayInputStream(input)));
+    }
+
+    /*
+     * Bad input detected in 
org.apache.commons.compress.harmony.unpack200.CpBands.parseCpUtf8(InputStream).
+     *
+     * An {@link IOException} wraps an {@link StringIndexOutOfBoundsException}.
      */
     @Test
     public void testCpBands_parseCpUtf8() throws IOException {

Reply via email to