HDFS-10795. Fix an error in ReaderStrategy#ByteBufferStrategy. Contributed by Sammi Chen
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/f4a21d3a Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/f4a21d3a Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/f4a21d3a Branch: refs/heads/HDFS-7240 Commit: f4a21d3abaa7c5a9f0a0d8417e81f7eaf3d1b29a Parents: 81485db Author: Kai Zheng <kai.zh...@intel.com> Authored: Sat Aug 27 10:54:25 2016 +0800 Committer: Kai Zheng <kai.zh...@intel.com> Committed: Sat Aug 27 10:54:25 2016 +0800 ---------------------------------------------------------------------- .../src/main/java/org/apache/hadoop/hdfs/ReaderStrategy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/f4a21d3a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ReaderStrategy.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ReaderStrategy.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ReaderStrategy.java index d75a8ef..c984c3b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ReaderStrategy.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ReaderStrategy.java @@ -181,7 +181,7 @@ class ByteBufferStrategy implements ReaderStrategy { int length) throws IOException { ByteBuffer tmpBuf = readBuf.duplicate(); tmpBuf.limit(tmpBuf.position() + length); - int nRead = blockReader.read(readBuf.slice()); + int nRead = blockReader.read(tmpBuf); // Only when data are read, update the position if (nRead > 0) { readBuf.position(readBuf.position() + nRead); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org