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
The following commit(s) were added to refs/heads/master by this push:
new b0e13a9be Throw CompressorException when all code lengths are zero
(#806).
b0e13a9be is described below
commit b0e13a9bee749ae2e214019a5f2968da85bd4f70
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Aug 23 15:03:22 2026 -0400
Throw CompressorException when all code lengths are zero (#806).
Add HuffmanDecoderTest.testAllCodeLengthsAreZeroWithMinMax()
---
.../org/apache/commons/compress/huffman/HuffmanDecoderTest.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git
a/src/test/java/org/apache/commons/compress/huffman/HuffmanDecoderTest.java
b/src/test/java/org/apache/commons/compress/huffman/HuffmanDecoderTest.java
index 6ba6d1ef0..530319658 100644
--- a/src/test/java/org/apache/commons/compress/huffman/HuffmanDecoderTest.java
+++ b/src/test/java/org/apache/commons/compress/huffman/HuffmanDecoderTest.java
@@ -152,11 +152,18 @@ private int decodeSymbol(final HuffmanDecoder decoder,
final int... data) throws
@Test
void testAllCodeLengthsAreZero() {
- final CompressorException e = assertThrows(CompressorException.class,
() -> new HuffmanDecoder(new int[] {0, 0, 0, 0, 0}),
+ final CompressorException e = assertThrows(CompressorException.class,
() -> new HuffmanDecoder(new int[] { 0, 0, 0, 0, 0 }),
"Expected CompressorException when all code lengths are zero");
assertEquals("All code lengths are zero", e.getMessage());
}
+ @Test
+ void testAllCodeLengthsAreZeroWithMinMax() {
+ final CompressorException e = assertThrows(CompressorException.class,
() -> new HuffmanDecoder(new int[] { 0, 0, 0 }, 0, 30),
+ "Expected CompressorException when all code lengths are zero
with min/max");
+ assertEquals("All code lengths are zero", e.getMessage());
+ }
+
@Test
void testCodeLengthBelowMinCodeLength() throws Exception {
final int[] codeLengths = new int[] {4, 2, 3, 0, 5, 5, 1};