Skip to content

Commit a67784e

Browse files
committed
HubSpot Backport: HADOOP-17837: Add unresolved endpoint value to UnknownHostException (#3)
1 parent 4be0499 commit a67784e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ public static void connect(Socket socket,
588588
} catch (SocketTimeoutException ste) {
589589
throw new ConnectTimeoutException(ste.getMessage());
590590
} catch (UnresolvedAddressException uae) {
591-
throw new UnknownHostException(uae.getMessage());
591+
throw new UnknownHostException(endpoint.toString());
592592
}
593593

594594
// There is a very rare case allowed by the TCP specification, such that

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ public void testInvalidAddress() throws Throwable {
111111
fail("Should not have connected");
112112
} catch (UnknownHostException uhe) {
113113
LOG.info("Got exception: ", uhe);
114+
assertEquals("invalid-test-host:0", uhe.getMessage());
114115
}
115116
}
116117

0 commit comments

Comments
 (0)