From 3f030c04e8ce7bdda8471ddb2d37b25b4686b121 Mon Sep 17 00:00:00 2001 From: Haohui Mai Date: Fri, 31 Oct 2014 11:47:41 -0700 Subject: [PATCH] HDFS-7315. DFSTestUtil.readFileBuffer opens extra FSDataInputStream. Contributed by Plamen Jeliazkov. --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index b1ea79c3a0..792839ff72 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -375,6 +375,9 @@ Release 2.7.0 - UNRELEASED HDFS-7263. Snapshot read can reveal future bytes for appended files. (Tao Luo via shv) + HDFS-7315. DFSTestUtil.readFileBuffer opens extra FSDataInputStream. + (Plamen Jeliazkov via wheat9) + Release 2.6.0 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java index f1cbe94a2c..cea2e82383 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java @@ -267,7 +267,7 @@ public static byte[] readFileBuffer(FileSystem fs, Path fileName) try { FSDataInputStream in = fs.open(fileName); try { - IOUtils.copyBytes(fs.open(fileName), os, 1024, true); + IOUtils.copyBytes(in, os, 1024, true); return os.toByteArray(); } finally { in.close();