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 7b053583e06343afbf130f14215e06f1c6de1ef5 Author: Gary Gregory <[email protected]> AuthorDate: Fri Jul 31 10:30:39 2026 -0400 Sort members --- .../compress/harmony/unpack200/BandSetTest.java | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/test/java/org/apache/commons/compress/harmony/unpack200/BandSetTest.java b/src/test/java/org/apache/commons/compress/harmony/unpack200/BandSetTest.java index 4347bab73..7546da705 100644 --- a/src/test/java/org/apache/commons/compress/harmony/unpack200/BandSetTest.java +++ b/src/test/java/org/apache/commons/compress/harmony/unpack200/BandSetTest.java @@ -78,19 +78,6 @@ void testDecodeBandIntRejectsNegativeCount() { () -> bandSet.parseReferences("Test", new ByteArrayInputStream(new byte[0]), codec, new int[] { -1, 1 }, new String[] { "a" })); } - @Test - void testParseCPUTF8AndSignatureReferencesRejectNegativeCount() { - final BHSDCodec codec = Codec.BYTE1; - // The int[] overloads of parseCPUTF8References and parseCPSignatureReferences size each sub-array straight - // from a per-entry count. A count decoded through a signed band can be negative, so it must be rejected - // here the same way decodeBandInt/parseFlags/parseReferences reject it, instead of reaching new CPUTF8[-1] - // and surfacing a NegativeArraySizeException that escapes the declared Pack200Exception contract. - assertThrows(Pack200Exception.class, - () -> bandSet.parseCPUTF8References("Test", new ByteArrayInputStream(new byte[0]), codec, new int[] { -1, 1 })); - assertThrows(Pack200Exception.class, - () -> bandSet.parseCPSignatureReferences("Test", new ByteArrayInputStream(new byte[0]), codec, new int[] { -1, 1 })); - } - @Test void testGetReferencesRejectsOutOfRangeIndex() throws Exception { // getReferences resolves band-decoded indices into a constant-pool array. An index at or past the @@ -105,6 +92,19 @@ void testGetReferencesRejectsOutOfRangeIndex() throws Exception { assertEquals("b", bandSet.getReferences(new int[] { 1 }, reference)[0]); } + @Test + void testParseCPUTF8AndSignatureReferencesRejectNegativeCount() { + final BHSDCodec codec = Codec.BYTE1; + // The int[] overloads of parseCPUTF8References and parseCPSignatureReferences size each sub-array straight + // from a per-entry count. A count decoded through a signed band can be negative, so it must be rejected + // here the same way decodeBandInt/parseFlags/parseReferences reject it, instead of reaching new CPUTF8[-1] + // and surfacing a NegativeArraySizeException that escapes the declared Pack200Exception contract. + assertThrows(Pack200Exception.class, + () -> bandSet.parseCPUTF8References("Test", new ByteArrayInputStream(new byte[0]), codec, new int[] { -1, 1 })); + assertThrows(Pack200Exception.class, + () -> bandSet.parseCPSignatureReferences("Test", new ByteArrayInputStream(new byte[0]), codec, new int[] { -1, 1 })); + } + @Test @Disabled("TODO: Implement") void testParseFlags1() {
