From e1e09052e861926112493d6041aae01ab594b547 Mon Sep 17 00:00:00 2001 From: Harsh J Date: Sun, 22 Mar 2015 02:44:36 +0530 Subject: [PATCH] MAPREDUCE-6213. NullPointerException caused by job history server addr not resolvable. Contributed by Peng Zhang. --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../org/apache/hadoop/mapreduce/v2/util/MRWebAppUtil.java | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 4f80411343a..76180a3364c 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -286,6 +286,9 @@ Release 2.8.0 - UNRELEASED BUG FIXES + MAPREDUCE-6213. NullPointerException caused by job history server addr not + resolvable. (Peng Zhang via harsh) + MAPREDUCE-6281. Fix javadoc in Terasort. (Albert Chu via ozawa) Release 2.7.0 - UNRELEASED 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 cac01191fcd..d367060eb19 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 @@ -137,8 +137,9 @@ public class MRWebAppUtil { hsAddress, getDefaultJHSWebappPort(), getDefaultJHSWebappURLWithoutScheme()); StringBuffer sb = new StringBuffer(); - if (address.getAddress().isAnyLocalAddress() || - address.getAddress().isLoopbackAddress()) { + if (address.getAddress() != null && + (address.getAddress().isAnyLocalAddress() || + address.getAddress().isLoopbackAddress())) { sb.append(InetAddress.getLocalHost().getCanonicalHostName()); } else { sb.append(address.getHostName()); @@ -171,4 +172,4 @@ public class MRWebAppUtil { public static String getAMWebappScheme(Configuration conf) { return "http://"; } -} \ No newline at end of file +}