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

(cherry picked from commit 5e54d92e6e)
This commit is contained in:
Bryan Beaudreault 2021-08-06 05:00:20 -04:00 committed by Wei-Chiu Chuang
parent e9ba4f4591
commit 7659b62682
No known key found for this signature in database
GPG Key ID: B362E1C021854B9D
2 changed files with 2 additions and 1 deletions

View File

@ -588,7 +588,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

View File

@ -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());
}
}