You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/11/21 17:43:00 UTC

[commons-compress] branch master updated: Use blocks.

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 ef28595  Use blocks.
ef28595 is described below

commit ef28595d5c69d8a52bbdcb7ab06d6734fdfd3cca
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 21 12:42:56 2020 -0500

    Use blocks.
---
 .../apache/commons/compress/compressors/deflate64/HuffmanDecoder.java | 3 ++-
 src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java  | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/compressors/deflate64/HuffmanDecoder.java b/src/main/java/org/apache/commons/compress/compressors/deflate64/HuffmanDecoder.java
index b0959df..fe45130 100644
--- a/src/main/java/org/apache/commons/compress/compressors/deflate64/HuffmanDecoder.java
+++ b/src/main/java/org/apache/commons/compress/compressors/deflate64/HuffmanDecoder.java
@@ -402,7 +402,7 @@ class HuffmanDecoder implements Closeable {
                 if (symbol < 16) {
                     value = symbol;
                     auxBuffer[off++] = value;
-                } else
+                } else {
                     switch (symbol) {
                     case 16:
                         length = (int) (readBits(reader, 2) + 3);
@@ -418,6 +418,7 @@ class HuffmanDecoder implements Closeable {
                     default:
                         break;
                     }
+                }
             }
         }
 
diff --git a/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java b/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
index 6fda1ac..2b396a1 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
@@ -784,7 +784,9 @@ public final class ZipTestCase extends AbstractTestCase {
     private void readStream(final InputStream in, final ArchiveEntry entry, final Map<String,List<List<Long>>> map) throws IOException {
         final byte[] buf = new byte[4096];
         final InputStreamStatistics stats = (InputStreamStatistics) in;
-        while (in.read(buf) != -1);
+        while (in.read(buf) != -1) {
+            // consume all.
+        }
 
         final String name = entry.getName();
         final List<List<Long>> l;