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 B31AF200D18 for ; Wed, 11 Oct 2017 11:06:54 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B0D871609E4; Wed, 11 Oct 2017 09:06:54 +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 023FC1609CA for ; Wed, 11 Oct 2017 11:06:53 +0200 (CEST) Received: (qmail 427 invoked by uid 500); 11 Oct 2017 09:06:53 -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 417 invoked by uid 99); 11 Oct 2017 09:06:52 -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, 11 Oct 2017 09:06:52 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B83F3F550E; Wed, 11 Oct 2017 09:06:52 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rohithsharmaks@apache.org To: common-commits@hadoop.apache.org Message-Id: <1bb96f78afc041bdbd8b9954a42358e7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: hadoop git commit: MAPREDUCE-6951. Improve exception message when mapreduce.jobhistory.webapp.address is in wrong format. Contributed by Prabhu Joseph. Date: Wed, 11 Oct 2017 09:06:52 +0000 (UTC) archived-at: Wed, 11 Oct 2017 09:06:54 -0000 Repository: hadoop Updated Branches: refs/heads/trunk d8d37b63c -> 639f98cc9 MAPREDUCE-6951. Improve exception message when mapreduce.jobhistory.webapp.address is in wrong format. Contributed by Prabhu Joseph. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/639f98cc Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/639f98cc Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/639f98cc Branch: refs/heads/trunk Commit: 639f98cc9dc9fca034d0d7c26f30d5c588b9d7b8 Parents: d8d37b6 Author: Rohith Sharma K S Authored: Wed Oct 11 14:27:38 2017 +0530 Committer: Rohith Sharma K S Committed: Wed Oct 11 14:27:38 2017 +0530 ---------------------------------------------------------------------- .../apache/hadoop/mapreduce/v2/util/MRWebAppUtil.java | 13 ++++++++++--- .../apache/hadoop/mapreduce/v2/util/TestMRApps.java | 9 +++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/639f98cc/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRWebAppUtil.java ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRWebAppUtil.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRWebAppUtil.java index 951c9d5..6f2e21f 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRWebAppUtil.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRWebAppUtil.java @@ -33,6 +33,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.UnknownHostException; +import java.util.NoSuchElementException; import java.util.Iterator; import static org.apache.hadoop.http.HttpConfig.Policy; @@ -126,9 +127,15 @@ public class MRWebAppUtil { throws UnknownHostException { //construct the history url for job String addr = getJHSWebappURLWithoutScheme(conf); - Iterator it = ADDR_SPLITTER.split(addr).iterator(); - it.next(); // ignore the bind host - String port = it.next(); + String port; + try{ + Iterator it = ADDR_SPLITTER.split(addr).iterator(); + it.next(); // ignore the bind host + port = it.next(); + } catch(NoSuchElementException e) { + throw new IllegalArgumentException("MapReduce JobHistory WebApp Address" + + " does not contain a valid host:port authority: " + addr); + } // Use hs address to figure out the host for webapp addr = conf.get(JHAdminConfig.MR_HISTORY_ADDRESS, JHAdminConfig.DEFAULT_MR_HISTORY_ADDRESS); http://git-wip-us.apache.org/repos/asf/hadoop/blob/639f98cc/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/test/java/org/apache/hadoop/mapreduce/v2/util/TestMRApps.java ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/test/java/org/apache/hadoop/mapreduce/v2/util/TestMRApps.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/test/java/org/apache/hadoop/mapreduce/v2/util/TestMRApps.java index 96b4e84..1e33b12 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/test/java/org/apache/hadoop/mapreduce/v2/util/TestMRApps.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/test/java/org/apache/hadoop/mapreduce/v2/util/TestMRApps.java @@ -51,6 +51,7 @@ import org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId; import org.apache.hadoop.mapreduce.v2.api.records.TaskId; import org.apache.hadoop.mapreduce.v2.api.records.TaskState; import org.apache.hadoop.mapreduce.v2.api.records.TaskType; +import org.apache.hadoop.mapreduce.v2.jobhistory.JHAdminConfig; import org.apache.hadoop.util.ApplicationClassLoader; import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.yarn.api.ApplicationConstants; @@ -527,4 +528,12 @@ public class TestMRApps { assertFalse("/fake/Klass must not be a system class", ApplicationClassLoader.isSystemClass("/fake/Klass", systemClasses)); } + + @Test(expected = IllegalArgumentException.class) + public void testInvalidWebappAddress() throws Exception { + Configuration conf = new Configuration(); + conf.set(JHAdminConfig.MR_HISTORY_WEBAPP_ADDRESS, "19888"); + MRWebAppUtil.getApplicationWebURLOnJHSWithScheme( + conf, ApplicationId.newInstance(0, 1)); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org