Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
HDFS >> mail # dev >> Problem in NetUtils


Copy link to this message
-
Re: Problem in NetUtils
0.21 is not actively maintained.
The bug was fixed in other active branches (0.20-security, 0.22, 0.23, etc.) and trunk.

Kihwal

On 10/12/11 7:50 PM, "Beckham007" <[EMAIL PROTECTED]> wrote:

Hi,
Today, I use org.apache.hadoop.net.NetUtils Class to change IP address and hostname.
 normalizeHostName
but I think the normalizeHostName didn't works well. The Character.digit(name.charAt(0), 16) != -1
couldn't tell whether it's a IP address or a hostname.

public static String normalizeHostName(String name) {
    if (Character.digit(name.charAt(0), 16) != -1) { // it is an IP
      return name;
    } else {
      try {
        InetAddress ipAddress = InetAddress.getByName(name);
        return ipAddress.getHostAddress();
      } catch (UnknownHostException e) {
        return name;
      }
    }
  }
The version of hadoop is 0.21.0
http://svn.apache.org/repos/asf/hadoop/common/tags/release-0.21.0/common/src/java/org/apache/hadoop/net/NetUtils.java
zhendong

NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB