HADOOP-9657. NetUtils.wrapException to have special handling for 0.0.0.0 addresses and :0 ports. Contributed by Varun Saxena.
(cherry picked from commit 67e7673750
)
This commit is contained in:
parent
f6d3c101a6
commit
0c8a2c2609
|
@ -742,18 +742,27 @@ public class NetUtils {
|
||||||
+ ";"
|
+ ";"
|
||||||
+ see("BindException"));
|
+ see("BindException"));
|
||||||
} else if (exception instanceof ConnectException) {
|
} else if (exception instanceof ConnectException) {
|
||||||
// connection refused; include the host:port in the error
|
// Check if client was trying to connect to an unspecified IPv4 address
|
||||||
return wrapWithMessage(exception,
|
// (0.0.0.0) or IPv6 address(0:0:0:0:0:0:0:0 or ::)
|
||||||
"Call From "
|
if ((destHost != null && (destHost.equals("0.0.0.0") ||
|
||||||
+ localHost
|
destHost.equals("0:0:0:0:0:0:0:0") || destHost.equals("::")))
|
||||||
+ " to "
|
|| destPort == 0) {
|
||||||
+ destHost
|
return wrapWithMessage(exception, "Your endpoint configuration" +
|
||||||
+ ":"
|
" is wrong;" + see("UnsetHostnameOrPort"));
|
||||||
+ destPort
|
} else {
|
||||||
+ " failed on connection exception: "
|
// connection refused; include the host:port in the error
|
||||||
+ exception
|
return wrapWithMessage(exception,
|
||||||
+ ";"
|
"Call From "
|
||||||
+ see("ConnectionRefused"));
|
+ localHost
|
||||||
|
+ " to "
|
||||||
|
+ destHost
|
||||||
|
+ ":"
|
||||||
|
+ destPort
|
||||||
|
+ " failed on connection exception: "
|
||||||
|
+ exception
|
||||||
|
+ ";"
|
||||||
|
+ see("ConnectionRefused"));
|
||||||
|
}
|
||||||
} else if (exception instanceof UnknownHostException) {
|
} else if (exception instanceof UnknownHostException) {
|
||||||
return wrapWithMessage(exception,
|
return wrapWithMessage(exception,
|
||||||
"Invalid host name: "
|
"Invalid host name: "
|
||||||
|
|
Loading…
Reference in New Issue