浏览代码

HADOOP-3434. Retain the cause of the bind failure in Server::bind.
Contributed by Steve Loughran.



git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@661540 13f79535-47bb-0310-9956-ffa450edef68

Christopher Douglas 17 年之前
父节点
当前提交
b2d7bc78bc
共有 2 个文件被更改,包括 7 次插入1 次删除
  1. 3 0
      CHANGES.txt
  2. 4 1
      src/java/org/apache/hadoop/ipc/Server.java

+ 3 - 0
CHANGES.txt

@@ -179,6 +179,9 @@ Trunk (unreleased changes)
     datanode, now can report corrupt replicas received from src node to
     the namenode. (Lohit Vijayarenu via rangadi)
 
+    HADOOP-3434. Retain the cause of the bind failure in Server::bind.
+    (Steve Loughran via cdouglas)
+
   OPTIMIZATIONS
 
     HADOOP-3274. The default constructor of BytesWritable creates empty 

+ 4 - 1
src/java/org/apache/hadoop/ipc/Server.java

@@ -165,7 +165,10 @@ public abstract class Server {
     try {
       socket.bind(address, backlog);
     } catch (BindException e) {
-      throw new BindException("Problem binding to " + address);
+      BindException bindException = new BindException("Problem binding to " + address
+                                                      + " : " + e.getMessage());
+      bindException.initCause(e);
+      throw bindException;
     } catch (SocketException e) {
       // If they try to bind to a different host's address, give a better
       // error message.