浏览代码

HADOOP-487. Throw a more informative exception for unknown RPC hosts.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@449856 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 19 年之前
父节点
当前提交
97f8b1f80c
共有 2 个文件被更改,包括 8 次插入3 次删除
  1. 3 0
      CHANGES.txt
  2. 5 3
      src/java/org/apache/hadoop/ipc/Client.java

+ 3 - 0
CHANGES.txt

@@ -73,6 +73,9 @@ Trunk (unreleased changes)
     build/, no longer modifying the source tree.
     (Arun C Murthy via cutting)
 
+19. HADOOP-487.  Throw a more informative exception for unknown RPC
+    hosts.  (Sameer Paranjpye via cutting)
+
 
 Release 0.6.2 (unreleased)
 

+ 5 - 3
src/java/org/apache/hadoop/ipc/Client.java

@@ -19,6 +19,7 @@ package org.apache.hadoop.ipc;
 import java.net.Socket;
 import java.net.InetSocketAddress;
 import java.net.SocketTimeoutException;
+import java.net.UnknownHostException;
 
 import java.io.IOException;
 import java.io.EOFException;
@@ -117,10 +118,11 @@ public class Client {
     private boolean shouldCloseConnection = false;
 
     public Connection(InetSocketAddress address) throws IOException {
+      if (address.isUnresolved()) {
+         throw new UnknownHostException("unknown host: " + address.getHostName());
+      }
       this.address = address;
-      this.setName("Client connection to "
-                   + address.getAddress().getHostAddress()
-                   + ":" + address.getPort());
+      this.setName("Client connection to " + address.toString());
       this.setDaemon(true);
     }