You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by su...@apache.org on 2017/10/12 09:38:03 UTC
[36/50] [abbrv] hadoop git commit: MAPREDUCE-6951. Improve exception
message when mapreduce.jobhistory.webapp.address is in wrong format.
Contributed by Prabhu Joseph.
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/YARN-5881
Commit: 639f98cc9dc9fca034d0d7c26f30d5c588b9d7b8
Parents: d8d37b6
Author: Rohith Sharma K S <ro...@apache.org>
Authored: Wed Oct 11 14:27:38 2017 +0530
Committer: Rohith Sharma K S <ro...@apache.org>
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<String> it = ADDR_SPLITTER.split(addr).iterator();
- it.next(); // ignore the bind host
- String port = it.next();
+ String port;
+ try{
+ Iterator<String> 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