hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acmur...@apache.org
Subject [1/2] hadoop git commit: HADOOP-9576. Changed NetUtils#wrapException to throw EOFException instead of wrapping it as IOException. Contributed by Steve Loughran
Date Wed, 12 Nov 2014 18:03:38 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.6.0 90061f286 -> fcd3067ab


HADOOP-9576. Changed NetUtils#wrapException to throw EOFException instead of wrapping it as
IOException. Contributed by Steve Loughran

Conflicts:
	hadoop-common-project/hadoop-common/CHANGES.txt


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/3dad831d
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/3dad831d
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/3dad831d

Branch: refs/heads/branch-2.6.0
Commit: 3dad831d368046f4c7a0b1370acaf728a7b76909
Parents: 90061f2
Author: Jian He <jianhe@apache.org>
Authored: Mon Nov 10 17:17:01 2014 -0800
Committer: Arun C. Murthy <acmurthy@apache.org>
Committed: Wed Nov 12 10:02:34 2014 -0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/hadoop/net/NetUtils.java   |  8 ++++++++
 .../test/java/org/apache/hadoop/net/TestNetUtils.java   | 12 ++++++++++++
 2 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/3dad831d/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java
index 9ee0f3e..b535dda 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java
@@ -17,6 +17,7 @@
  */
 package org.apache.hadoop.net;
 
+import java.io.EOFException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -759,6 +760,13 @@ public class NetUtils {
               + " failed on socket timeout exception: " + exception
               + ";"
               + see("NoRouteToHost"));
+    } else if (exception instanceof EOFException) {
+      return wrapWithMessage(exception,
+          "End of File Exception between "
+              + getHostDetailsAsString(destHost,  destPort, localHost)
+              + ": " + exception
+              + ";"
+              + see("EOFException"));
     }
     else {
       return (IOException) new IOException("Failed on local exception: "

http://git-wip-us.apache.org/repos/asf/hadoop/blob/3dad831d/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestNetUtils.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestNetUtils.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestNetUtils.java
index b03afca..319e8a9 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestNetUtils.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestNetUtils.java
@@ -19,6 +19,7 @@ package org.apache.hadoop.net;
 
 import static org.junit.Assert.*;
 
+import java.io.EOFException;
 import java.io.IOException;
 import java.net.BindException;
 import java.net.ConnectException;
@@ -257,6 +258,17 @@ public class TestNetUtils {
   }
   
   @Test
+  public void testWrapEOFException() throws Throwable {
+    IOException e = new EOFException("eof");
+    IOException wrapped = verifyExceptionClass(e, EOFException.class);
+    assertInException(wrapped, "eof");
+    assertWikified(wrapped);
+    assertInException(wrapped, "localhost");
+    assertRemoteDetailsIncluded(wrapped);
+    assertInException(wrapped, "/EOFException");
+  }
+  
+  @Test
   public void testGetConnectAddress() throws IOException {
     NetUtils.addStaticResolution("host", "127.0.0.1");
     InetSocketAddress addr = NetUtils.createSocketAddrForHost("host", 1);


Mime
View raw message