Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B007B200D4C for ; Thu, 26 Oct 2017 01:14:02 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id AEA27160BF6; Wed, 25 Oct 2017 23:14:02 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 00525160BE0 for ; Thu, 26 Oct 2017 01:14:01 +0200 (CEST) Received: (qmail 52812 invoked by uid 500); 25 Oct 2017 23:13:55 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 52257 invoked by uid 99); 25 Oct 2017 23:13:55 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Oct 2017 23:13:55 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id ED913E08A1; Wed, 25 Oct 2017 23:13:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: templedf@apache.org To: common-commits@hadoop.apache.org Date: Wed, 25 Oct 2017 23:13:56 -0000 Message-Id: In-Reply-To: <7883c3ead2e84647abaa496d527afb46@git.apache.org> References: <7883c3ead2e84647abaa496d527afb46@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [04/50] [abbrv] hadoop git commit: HADOOP-9657. NetUtils.wrapException to have special handling for 0.0.0.0 addresses and :0 ports. Contributed by Varun Saxena. archived-at: Wed, 25 Oct 2017 23:14:02 -0000 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 67e7673750e731f5ecfa84e82b84b7fc7ee0b233) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/5be228e4 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/5be228e4 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/5be228e4 Branch: refs/heads/resource-types Commit: 5be228e43b0f12f8c319b93312be8106e2900c27 Parents: 107afed Author: Varun Saxena Authored: Wed Oct 25 03:06:12 2017 +0530 Committer: Varun Saxena Committed: Wed Oct 25 03:22:18 2017 +0530 ---------------------------------------------------------------------- .../java/org/apache/hadoop/net/NetUtils.java | 33 +++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/5be228e4/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java index 8577336..4697320 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java @@ -742,18 +742,27 @@ public class NetUtils { + ";" + see("BindException")); } else if (exception instanceof ConnectException) { - // connection refused; include the host:port in the error - return wrapWithMessage(exception, - "Call From " - + localHost - + " to " - + destHost - + ":" - + destPort - + " failed on connection exception: " - + exception - + ";" - + see("ConnectionRefused")); + // Check if client was trying to connect to an unspecified IPv4 address + // (0.0.0.0) or IPv6 address(0:0:0:0:0:0:0:0 or ::) + if ((destHost != null && (destHost.equals("0.0.0.0") || + destHost.equals("0:0:0:0:0:0:0:0") || destHost.equals("::"))) + || destPort == 0) { + return wrapWithMessage(exception, "Your endpoint configuration" + + " is wrong;" + see("UnsetHostnameOrPort")); + } else { + // connection refused; include the host:port in the error + return wrapWithMessage(exception, + "Call From " + + localHost + + " to " + + destHost + + ":" + + destPort + + " failed on connection exception: " + + exception + + ";" + + see("ConnectionRefused")); + } } else if (exception instanceof UnknownHostException) { return wrapWithMessage(exception, "Invalid host name: " --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org