From b9954debd1d9aae92fa1a070d152106350fbd5be Mon Sep 17 00:00:00 2001
From: Chad Metcalf <chad@cloudera.com>
Date: Tue, 10 Nov 2009 16:58:56 -0800
Subject: [PATCH] HDFS-732. HDFS files are ending up truncated

---
 src/hdfs/org/apache/hadoop/hdfs/DFSClient.java |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java b/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java
index b091d11..026ea63 100644
--- a/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java
+++ b/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java
@@ -3146,8 +3146,13 @@ public class DFSClient implements FSConstants, java.io.Closeable {
      */
     @Override
     public void close() throws IOException {
-      if(closed)
-        return;
+      if (closed) {
+        IOException e = lastException;
+        if (e == null)
+          return;
+        else
+          throw e;
+      }
       closeInternal();
       leasechecker.remove(src);
       
-- 
1.6.0.4

