瀏覽代碼

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
     datanode, now can report corrupt replicas received from src node to
     the namenode. (Lohit Vijayarenu via rangadi)
     the namenode. (Lohit Vijayarenu via rangadi)
 
 
+    HADOOP-3434. Retain the cause of the bind failure in Server::bind.
+    (Steve Loughran via cdouglas)
+
   OPTIMIZATIONS
   OPTIMIZATIONS
 
 
     HADOOP-3274. The default constructor of BytesWritable creates empty 
     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 {
     try {
       socket.bind(address, backlog);
       socket.bind(address, backlog);
     } catch (BindException e) {
     } 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) {
     } catch (SocketException e) {
       // If they try to bind to a different host's address, give a better
       // If they try to bind to a different host's address, give a better
       // error message.
       // error message.