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
commit 53abc650d0bfaf94a7dc1e2044c0c8495acb66a8 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Wed Apr 9 18:06:25 2025 -0400 Refactor magic number --- .../org/apache/commons/compress/compressors/lzw/LZWInputStream.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java index 6aef44a30..bc5a96223 100644 --- a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java +++ b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java @@ -37,6 +37,7 @@ * @since 1.10 */ public abstract class LZWInputStream extends CompressorInputStream implements InputStreamStatistics { + private static final int MAX_CODE_SIZE = 31; protected static final int DEFAULT_CODE_SIZE = 9; protected static final int UNUSED_PREFIX = -1; @@ -268,7 +269,7 @@ private int readFromStack(final byte[] b, final int off, final int len) { * @throws IOException on error */ protected int readNextCode() throws IOException { - if (codeSize > 31) { + if (codeSize > MAX_CODE_SIZE) { throw new IllegalArgumentException("Code size must not be bigger than 31"); } return (int) in.readBits(codeSize);