diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 7e0e6a5617..bbba5c2bd8 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -547,6 +547,9 @@ Release 2.0.4-alpha - UNRELEASED BUG FIXES + HADOOP-9369. DNS#reverseDns() can return hostname with . appended at the + end. (Karthik Kambatla via atm) + Release 2.0.3-alpha - 2013-02-06 INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/DNS.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/DNS.java index 73bbd4a631..f19e80235b 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/DNS.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/DNS.java @@ -89,7 +89,12 @@ public class DNS { ictx.close(); } - return attribute.get("PTR").get().toString(); + String hostname = attribute.get("PTR").get().toString(); + int hostnameLength = hostname.length(); + if (hostname.charAt(hostnameLength - 1) == '.') { + hostname = hostname.substring(0, hostnameLength - 1); + } + return hostname; } /**