InetAddress.getHostName() does not resolve host names, which differs from the
Sun's JDK behaviour. Consider the following test case:
import java.net.InetAddress;
public class Test {
public static void main(String[] argv) throws Exception {
String resolved = InetAddress.getByName("127.0.0.1").getHostName();
System.out.println("127.0.0.1 hostname: expected=localhost, actual=" +
resolved);
}
}
With Sun's JDK:
$ java -version
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
$ javac Test.java
$ java -cp . Test
127.0.0.1 hostname: expected=localhost, actual=localhost
With GCJ 4.2 (snapshot of 20061128):
$ gcj -v
Using built-in specs.
Reading specs from
/opt/gcc-4.2/lib/gcc/sparc-sun-solaris2.8/4.2.0/../../../libgcj.spec
rename spec startfile to startfileorig
rename spec lib to liborig
Target: sparc-sun-solaris2.8
Configured with: ../gcc-4.2-20061128/configure --prefix=/opt/gcc-4.2
--disable-nls
Thread model: posix
gcc version 4.2.0 20061128 (prerelease)
$ gcj -L/opt/gcc-4.2/lib -lstdc++ -L/usr/local/lib -o Test --main=Test
Test.class
$ ./Test
127.0.0.1 hostname: expected=localhost, actual=127.0.0.1
Same results with gcj 4.0.2.
--
Summary: InetAddress.getHostName() does not resolve host names
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgcj
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: renaud dot saintgratien at orange-ftgroup dot com
GCC host triplet: sparc-sun-solaris2.8
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30109