Re: InetAddress.equals() Anomoly?

From: Pete Loveall (psl_at_ametx.com.NO_SPAM)
Date: 01/07/05


Date: Fri, 7 Jan 2005 09:49:59 -0600

Definite J# bug!

The following output was produced by the code below:

203574117 203574117
firenet.us/12.34.75.101=grande.rivcom.net/12.34.75.101->false
grande.rivcom.net/12.34.75.101=firenet.us/12.34.75.101->false

import java.net.*;

public class Class1
{
public Class1()
{
}
/** @attribute System.STAThread() */
public static void main(String[] args)
{
InetAddress dnsaddr = null;
InetAddress ipaddr = null;
try
{
dnsaddr = InetAddress.getByName("firenet.us");
ipaddr = InetAddress.getByName("12.34.75.101");
}
catch (Exception e)
{
e.printStackTrace();
}
System.out.println(dnsaddr.hashCode()+" "+ipaddr.hashCode());
System.out.println(dnsaddr.toString()+"="+ipaddr.toString()+"->"+dnsaddr.equals(ipaddr));
System.out.println(ipaddr.toString()+"="+dnsaddr.toString()+"->"+ipaddr.equals(dnsaddr));
try
{
System.in.read();
}
catch (Exception e){}
}
}


Loading