aboutsummaryrefslogtreecommitdiff
path: root/libjava/java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java')
-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 24743cc..3306803 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();
}