HADOOP-9369. DNS#reverseDns() can return hostname with . appended at the end. Contributed by Karthik Kambatla.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1454172 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Aaron Myers 2013-03-07 23:50:40 +00:00
parent 7122cb5bf4
commit 21a1c8acba
2 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -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;
}
/**