diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupInputStream.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupInputStream.java index 2b10578824..2f17035036 100644 --- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupInputStream.java +++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupInputStream.java @@ -129,7 +129,8 @@ public synchronized int read(byte[] b, int off, int len) throws IOException { totalReadLen += numBytesRead; off += numBytesRead; len -= numBytesRead; - if (current.getRemaining() <= 0) { + if (current.getRemaining() <= 0 && + ((currentStreamIndex + 1) < streamEntries.size())) { currentStreamIndex += 1; } }