InetAddress.java (getCanonicalHostName): Support IPv6 addresses.

2004-11-17  Michael Koch  <konqueror@gmx.de>

	* java/net/InetAddress.java (getCanonicalHostName):
	Support IPv6 addresses.

From-SVN: r90793
This commit is contained in:
Michael Koch 2004-11-17 07:09:57 +00:00 committed by Michael Koch
parent 7c8347536f
commit 879245b6b2
2 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2004-11-17 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java (getCanonicalHostName):
Support IPv6 addresses.
2004-11-16 Michael Koch <konqueror@gmx.de>
* java/lang/Object.java: Added javadocs all over (merged from GNU

View File

@ -322,8 +322,14 @@ public class InetAddress implements Serializable
}
// Try to find the FDQN now
// FIXME: This does not work with IPv6.
InetAddress address = new Inet4Address(getAddress(), null);
InetAddress address;
byte[] ipaddr = getAddress();
if (ipaddr.length == 16)
address = new Inet6Address(getAddress(), null);
else
address = new Inet4Address(getAddress(), null);
return address.getHostName();
}