Browse Source

HDDS-627. OzoneFS read from an MR Job throws java.lang.ArrayIndexOutOfBoundsException. Contributed by Mukul Kumar Singh.

(cherry picked from commit c05b260069511f2993a67683555ed2e1aea49a0a)
Xiaoyu Yao 6 years ago
parent
commit
72ac4e8238

+ 2 - 1
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;
       }
     }