Name: rmT116609 Date: 11/04/2002
FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
FULL OPERATING SYSTEM VERSION :
glibc-2.2.5-55
Linux swlinux 2.4.18-4GB #1 Wed May 29 15:47:24 UTC 2002 i686
SuSE Linux 8.0 (i386)
VERSION = 8.0
A DESCRIPTION OF THE PROBLEM :
InetAddress.getCanonicalHostName() is not returning the fully-qualified domain name. Instead, it is returning the IP address. We really need the fully-qualified domain name, and this is the only routine documented to return
it. The code only fails on SuSE 8.0. We're sucessfully running in on Windows 2000, several versions of Red Hat Linux, and several versions of HP-UX.
EXPECTED VERSUS ACTUAL BEHAVIOR :
The output of my test program on Red Hat Linux 7.1
(expected results):
My name is: kothay.fc.hp.com
My FQDN is: kothay.fc.hp.com
My IP is: 15.1.52.194
InetAddress: kothay.fc.hp.com/15.1.52.194
The output of my test program on SuSE 8.0 (actual results):
My name is: swlinux
My FQDN is: 15.1.50.18
My IP is: 15.1.50.18
InetAddress: swlinux/15.1.50.18
ERROR MESSAGES/STACK TRACES THAT OCCUR :
There are no error messages.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.net.UnknownHostException;
public class hostnameBug
{
public static void main(String args[])
{
try
{
InetAddress ia = InetAddress.getLocalHost();
System.out.println("My name is: " + ia.getHostName());
System.out.println("My FQDN is: " + ia.getCanonicalHostName());
System.out.println(" My IP is: " + ia.getHostAddress());
System.out.println("\nInetAddress: " + ia);
}
catch (UnknownHostException e)
{
System.out.println("oops, couldn't get localhost");
}
}
}
---------- END SOURCE ----------
(Review ID: 166641)
======================================================================