浏览代码

HADOOP-1129. Fix DFSClient to not hide IOExceptions in flush method. Contributed by Hairong Kuang.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@519431 13f79535-47bb-0310-9956-ffa450edef68
Thomas White 18 年之前
父节点
当前提交
8e62cc62b8

+ 3 - 0
CHANGES.txt

@@ -73,6 +73,9 @@ Trunk (unreleased changes)
     (Espen Amble Kolstad, Andrzej Bialecki, and Owen O'Malley
     via tomwhite)
 
+22. HADOOP-1129.  Fix DFSClient to not hide IOExceptions in
+    flush method.  (Hairong Kuang via tomwhite)
+
 
 Release 0.12.0 - 2007-03-02
 

+ 1 - 1
src/java/org/apache/hadoop/fs/ChecksumFileSystem.java

@@ -404,7 +404,7 @@ public abstract class ChecksumFileSystem extends FilterFileSystem {
       if(sums != null) {
         sums.close();
       }
-      super.close();
+      out.close();
     }
     
     public static long getChecksumLength(long size, int bytesPerSum) {

+ 14 - 0
src/java/org/apache/hadoop/fs/FSDataOutputStream.java

@@ -43,6 +43,10 @@ public class FSDataOutputStream extends DataOutputStream {
       return position;                            // return cached position
     }
     
+    public void close() throws IOException {
+      flush();
+      out.close();
+    }
   }
 
   private static class Buffer extends BufferedOutputStream {
@@ -62,6 +66,11 @@ public class FSDataOutputStream extends DataOutputStream {
         buf[count++] = (byte)b;
       }
     }
+
+    public void close() throws IOException {
+      flush();
+      out.close();
+    }
   }
 
   public FSDataOutputStream(OutputStream out, int bufferSize)
@@ -77,4 +86,9 @@ public class FSDataOutputStream extends DataOutputStream {
   public long getPos() throws IOException {
     return ((Buffer)out).getPos();
   }
+
+  public void close() throws IOException {
+    flush();
+    out.close();
+  }
 }