You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2024/07/25 22:33:34 UTC
(commons-compress) 01/01: Fix for COMPRESS-684
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch compress-684
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit 8fe12ab26aec14fe324990628370fd70aa55cfcc
Author: Sebb <se...@apache.org>
AuthorDate: Thu Jul 25 23:33:27 2024 +0100
Fix for COMPRESS-684
Note:
assert a or b
is equivalent to
if (!(a || b)) throw Exception
which by de Morgan can be simplified as
if (!a && !b) throw Exception
---
.../commons/compress/compressors/gzip/GzipCompressorInputStream.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
index 930f6e0d9..4bc225e9b 100644
--- a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
@@ -204,7 +204,9 @@ public class GzipCompressorInputStream extends CompressorInputStream implements
}
private boolean init(final boolean isFirstMember) throws IOException {
- assert isFirstMember || decompressConcatenated;
+ if (!isFirstMember && !decompressConcatenated) { // at least one must be true
+ throw new IllegalStateException("Unexpected: isFirstMember and decompressConcatenated are both false!");
+ }
// Check the magic bytes without a possibility of EOFException.
final int magic0 = in.read();