You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2019/08/18 15:07:22 UTC

[commons-compress] 02/02: COMPRESS-231 deal with edge case

This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git

commit 8bdb913000d7cceb0b7ac966fd3d1583280182c3
Author: Stefan Bodewig <bo...@apache.org>
AuthorDate: Sun Aug 18 17:06:49 2019 +0200

    COMPRESS-231 deal with edge case
---
 .../commons/compress/utils/MultiReadOnlySeekableByteChannel.java       | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/main/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannel.java b/src/main/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannel.java
index e9c86ee..221294b 100644
--- a/src/main/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannel.java
+++ b/src/main/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannel.java
@@ -64,6 +64,9 @@ public class MultiReadOnlySeekableByteChannel implements SeekableByteChannel {
         if (!isOpen()) {
             throw new ClosedChannelException();
         }
+        if (!dst.hasRemaining()) {
+            return 0;
+        }
 
         int totalBytesRead = 0;
         while (dst.hasRemaining() && currentChannelIdx < channels.size()) {