Forráskód Böngészése

HADOOP-17837: Add unresolved endpoint value to UnknownHostException (#3272)

Bryan Beaudreault 3 éve
szülő
commit
5e54d92e6e

+ 1 - 1
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java

@@ -589,7 +589,7 @@ public class NetUtils {
     } catch (SocketTimeoutException ste) {
       throw new ConnectTimeoutException(ste.getMessage());
     }  catch (UnresolvedAddressException uae) {
-      throw new UnknownHostException(uae.getMessage());
+      throw new UnknownHostException(endpoint.toString());
     }
 
     // There is a very rare case allowed by the TCP specification, such that

+ 1 - 0
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestNetUtils.java

@@ -111,6 +111,7 @@ public class TestNetUtils {
       fail("Should not have connected");
     } catch (UnknownHostException uhe) {
       LOG.info("Got exception: ", uhe);
+      assertEquals("invalid-test-host:0", uhe.getMessage());
     }
   }