Browse Source

HADOOP-2931. IOException thrown by DFSOutputStream had wrong stack
trace in some cases. (Michael Bieniosek via rangadi)


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.16@633344 13f79535-47bb-0310-9956-ffa450edef68

Raghu Angadi 17 years ago
parent
commit
39ef399f81
2 changed files with 9 additions and 2 deletions
  1. 3 0
      CHANGES.txt
  2. 6 2
      src/java/org/apache/hadoop/dfs/DFSClient.java

+ 3 - 0
CHANGES.txt

@@ -97,6 +97,9 @@ Release 0.16.1 - Unreleased
     HADOOP-2809.  Fix HOD syslog config syslog-address so that it works.
     (Hemanth Yamijala via nigel)
 
+    HADOOP-2931. IOException thrown by DFSOutputStream had wrong stack
+    trace in some cases. (Michael Bieniosek via rangadi)
+
 Release 0.16.0 - 2008-02-07
 
   INCOMPATIBLE CHANGES

+ 6 - 2
src/java/org/apache/hadoop/dfs/DFSClient.java

@@ -1503,7 +1503,7 @@ class DFSClient implements FSConstants {
     private DatanodeInfo[] nodes = null; // list of targets for current block
     private volatile boolean hasError = false;
     private volatile int errorIndex = 0;
-    private IOException lastException = new IOException("Stream closed.");
+    private IOException lastException = null;
     private long artificialSlowdown = 0;
 
     private class Packet {
@@ -1869,7 +1869,11 @@ class DFSClient implements FSConstants {
 
     private void isClosed() throws IOException {
       if (closed) {
-        throw lastException;
+        if (lastException != null) {
+          throw lastException;
+        } else {
+          throw new IOException("Stream closed.");
+        }
       }
     }