hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1454176 - in /hadoop/common/branches/branch-1: CHANGES.txt src/core/org/apache/hadoop/net/DNS.java
Date Thu, 07 Mar 2013 23:56:02 GMT
Author: atm
Date: Thu Mar  7 23:56:02 2013
New Revision: 1454176

URL: http://svn.apache.org/r1454176
Log:
HADOOP-9369. DNS#reverseDns() can return hostname with . appended at the end. Contributed
by Karthik Kambatla.

Modified:
    hadoop/common/branches/branch-1/CHANGES.txt
    hadoop/common/branches/branch-1/src/core/org/apache/hadoop/net/DNS.java

Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1454176&r1=1454175&r2=1454176&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Thu Mar  7 23:56:02 2013
@@ -534,6 +534,9 @@ Release 1.2.0 - unreleased
     MAPREDUCE-5049. CombineFileInputFormat counts all compressed files 
     non-splitable. (sandyr via tucu)
 
+    HADOOP-9369. DNS#reverseDns() can return hostname with . appended at the
+    end. (Karthik Kambatla via atm)
+
 Release 1.1.2 - 2013.01.30
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-1/src/core/org/apache/hadoop/net/DNS.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/core/org/apache/hadoop/net/DNS.java?rev=1454176&r1=1454175&r2=1454176&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/core/org/apache/hadoop/net/DNS.java (original)
+++ hadoop/common/branches/branch-1/src/core/org/apache/hadoop/net/DNS.java Thu Mar  7 23:56:02
2013
@@ -76,7 +76,12 @@ public class DNS {
                          "/" + reverseIP, new String[] { "PTR" });
     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;
   }
 
   /**



Mime
View raw message