diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 9b29cb77c0c..4d3d07e8a27 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -301,6 +301,11 @@ Release 2.6.0 - UNRELEASED HDFS-6892. Add XDR packaging method for each NFS request (brandonli) + HDFS-6938. Cleanup javac warnings in FSNamesystem (Charles Lamb via wheat9) + + HDFS-6902. FileWriter should be closed in finally block in + BlockReceiver#receiveBlock() (Tsuyoshi OZAWA via Colin Patrick McCabe) + Release 2.5.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java index afa8bbba481..bfb22331250 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java @@ -825,15 +825,17 @@ class BlockReceiver implements Closeable { LOG.warn("Failed to delete restart meta file: " + restartMeta.getPath()); } + FileWriter out = null; try { - FileWriter out = new FileWriter(restartMeta); + out = new FileWriter(restartMeta); // write out the current time. out.write(Long.toString(Time.now() + restartBudget)); out.flush(); - out.close(); } catch (IOException ioe) { // The worst case is not recovering this RBW replica. // Client will fall back to regular pipeline recovery. + } finally { + IOUtils.cleanup(LOG, out); } try { // Even if the connection is closed after the ack packet is