summaryrefslogtreecommitdiff
path: root/libjava/java/net
diff options
context:
space:
mode:
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-17 07:09:57 +0000
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-17 07:09:57 +0000
commitc7e0a5241ddd1e81d0d1a81f6c00a8549a66dced (patch)
tree6e34644be784f7f8c67bcab04e74d439de258383 /libjava/java/net
parentc7921ee97efc523ed04af98623b34be92cc12b4b (diff)
downloadgcc-c7e0a5241ddd1e81d0d1a81f6c00a8549a66dced.tar.gz
2004-11-17 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java (getCanonicalHostName): Support IPv6 addresses. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@90793 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/net')
-rw-r--r--libjava/java/net/InetAddress.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/libjava/java/net/InetAddress.java b/libjava/java/net/InetAddress.java
index 24743cc1acc..33068031884 100644
--- a/libjava/java/net/InetAddress.java
+++ b/libjava/java/net/InetAddress.java
@@ -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();
}