浏览代码

HDFS-732. DFSClient.DFSOutputStream.close() should throw an exception if the stream cannot be closed successfully.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20@831184 13f79535-47bb-0310-9956-ffa450edef68
Tsz-wo Sze 15 年之前
父节点
当前提交
e8e7b8d0fe
共有 2 个文件被更改,包括 10 次插入2 次删除
  1. 3 0
      CHANGES.txt
  2. 7 2
      src/hdfs/org/apache/hadoop/hdfs/DFSClient.java

+ 3 - 0
CHANGES.txt

@@ -51,6 +51,9 @@ Release 0.20.2 - Unreleased
 
     HDFS-723. Fix deadlock in DFSClient#DFSOutputStream. (hairong)
 
+    HDFS-732. DFSClient.DFSOutputStream.close() should throw an exception if
+    the stream cannot be closed successfully.  (szetszwo)
+
 Release 0.20.1 - 2009-09-01
 
   INCOMPATIBLE CHANGES

+ 7 - 2
src/hdfs/org/apache/hadoop/hdfs/DFSClient.java

@@ -3154,8 +3154,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);