JDK-4065543 : getByName returns a different result from the one for getLocalHost
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 1.1.3
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5.1
  • CPU: sparc
  • Submitted: 1997-07-18
  • Updated: 1997-08-30
  • Resolved: 1997-08-30
Related Reports
Duplicate :  
Description

Name: rlT66838			Date: 07/17/97


1. To get InetAddress object for local host, I wrote the source code like the following.

      InetAddress thishost = InetAddress.getByName(null);

   In this case, getByName returns the followings.

      localhost/127.0.0.1

2. As the other way, I wrote the following code to get InetAddress object for local host.

      InetAddress thishost = InetAddress.getLocalHost();

   In this case, getLocalHost returns the followings on my environment.

      icarus/XXX.XXX.XXX.XXX
      (In fact, XXX.XXX.XXX.XXX is correct IP address.)

   icarus is the host name for the machine executing that program.
   So, I think getByName returns wrong result.



======================================================================

Comments
WORK AROUND Name: rlT66838 Date: 07/17/97 There are the entries for "icarus" and "localhost" in /etc/host file. ======================================================================
11-06-2004

EVALUATION Yet another duplicate of the localhost bug... Closed as dup of 4073539. benjamin.renaud@Eng 1997-08-29
29-08-1997