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:20 UTC

[commons-compress] branch master updated (e959762 -> 8bdb913)

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

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


    from e959762  COMPRESS-231 add a concatenated SeekableByteChannel based on code by Tim Underwood
     new 7d4e6b2  whitespace
     new 8bdb913  COMPRESS-231 deal with edge case

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../commons/compress/utils/MultiReadOnlySeekableByteChannel.java  | 5 ++++-
 .../compress/utils/MultiReadOnlySeekableByteChannelTest.java      | 8 ++++----
 2 files changed, 8 insertions(+), 5 deletions(-)


[commons-compress] 01/02: whitespace

Posted by bo...@apache.org.
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 7d4e6b213ff87ca61982a7c55a7869ba99fabcd0
Author: Stefan Bodewig <bo...@apache.org>
AuthorDate: Sun Aug 18 17:04:19 2019 +0200

    whitespace
---
 .../commons/compress/utils/MultiReadOnlySeekableByteChannel.java  | 2 +-
 .../compress/utils/MultiReadOnlySeekableByteChannelTest.java      | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

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 fd78f9d..e9c86ee 100644
--- a/src/main/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannel.java
+++ b/src/main/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannel.java
@@ -143,7 +143,7 @@ public class MultiReadOnlySeekableByteChannel implements SeekableByteChannel {
     public int write(ByteBuffer src) {
         throw new NonWritableChannelException();
     }
-    
+
     @Override
     public synchronized SeekableByteChannel position(long newPosition) throws IOException {
         if (newPosition < 0) {
diff --git a/src/test/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannelTest.java b/src/test/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannelTest.java
index 0892077..a405ed8 100644
--- a/src/test/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannelTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannelTest.java
@@ -46,13 +46,13 @@ public class MultiReadOnlySeekableByteChannelTest {
         thrown.expect(NullPointerException.class);
         new MultiReadOnlySeekableByteChannel(null);
     }
-    
+
     @Test
     public void forSeekableByteChannelsThrowsOnNullArg() {
         thrown.expect(NullPointerException.class);
         MultiReadOnlySeekableByteChannel.forSeekableByteChannels(null);
     }
-    
+
     @Test
     public void forFilesThrowsOnNullArg() throws IOException {
         thrown.expect(NullPointerException.class);
@@ -80,13 +80,13 @@ public class MultiReadOnlySeekableByteChannelTest {
     public void checkForSingleByte() throws IOException {
         check(new byte[] { 0 });
     }
-    
+
     @Test
     public void checkForString() throws IOException {
         check("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
             .getBytes(StandardCharsets.UTF_8));
     }
-    
+
     @Test
     public void verifyGrouped() {
         Assert.assertArrayEquals(new byte[][] {


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

Posted by bo...@apache.org.
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()) {