HDFS-11719. Arrays.fill() wrong index in BlockSender.readChecksum() exception handling. Contributed by Tao Zhang
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/6ff509c3 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/6ff509c3 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/6ff509c3 Branch: refs/heads/YARN-7402 Commit: 6ff509c32a781eede0e246a0593f6e753fb25d05 Parents: 48319d6 Author: Mingliang Liu <lium...@apache.org> Authored: Tue Sep 18 10:20:15 2018 -0700 Committer: Mingliang Liu <lium...@apache.org> Committed: Tue Sep 18 10:25:28 2018 -0700 ---------------------------------------------------------------------- .../org/apache/hadoop/hdfs/server/datanode/BlockSender.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/6ff509c3/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockSender.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockSender.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockSender.java index 268007f..bff47fa 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockSender.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockSender.java @@ -682,16 +682,17 @@ class BlockSender implements java.io.Closeable { + " at offset " + offset + " for block " + block, e); ris.closeChecksumStream(); if (corruptChecksumOk) { - if (checksumOffset < checksumLen) { + if (checksumLen > 0) { // Just fill the array with zeros. - Arrays.fill(buf, checksumOffset, checksumLen, (byte) 0); + Arrays.fill(buf, checksumOffset, checksumOffset + checksumLen, + (byte) 0); } } else { throw e; } } } - + /** * Compute checksum for chunks and verify the checksum that is read from * the metadata file is correct. --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org