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 2b10578824a..2f170350367 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 class ChunkGroupInputStream extends InputStream implements Seekable { totalReadLen += numBytesRead; off += numBytesRead; len -= numBytesRead; - if (current.getRemaining() <= 0) { + if (current.getRemaining() <= 0 && + ((currentStreamIndex + 1) < streamEntries.size())) { currentStreamIndex += 1; } }