[kaffe] CVS kaffe (kaz): libraries/javalib/java/net/InetAddress.java:

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Fri Oct 31 07:18:02 2003


PatchSet 4146 
Date: 2003/10/31 15:15:42
Author: kaz
Branch: HEAD
Tag: (none) 
Log:
2003-10-31  Ito Kazumitsu <kaz@maczuka.gcd.org>

        * libraries/javalib/java/net/InetAddress.java:
        (getAllByName) check whether getHostByName returns IPv6 address. If it
        is the case we build Inet6Address instead of InetAddress. Originally
        patched by Guilhem Lavaux on 2003-09-09 but lost when last updated.

Members: 
	ChangeLog:1.1738->1.1739 
	libraries/javalib/java/net/InetAddress.java:1.18->1.19 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1738 kaffe/ChangeLog:1.1739
--- kaffe/ChangeLog:1.1738	Thu Oct 30 22:05:00 2003
+++ kaffe/ChangeLog	Fri Oct 31 15:15:42 2003
@@ -1,3 +1,10 @@
+2003-10-31  Ito Kazumitsu <kaz@maczuka.gcd.org>
+
+	* libraries/javalib/java/net/InetAddress.java:
+	(getAllByName) check whether getHostByName returns IPv6 address. If it
+	is the case we build Inet6Address instead of InetAddress. Originally
+	patched by Guilhem Lavaux on 2003-09-09 but lost when last updated.
+
 2003-10-30  Dalibor Topic <robilad@kaffe.org>
 
 	* config/powerpc/sysdepCallMethod.h:
Index: kaffe/libraries/javalib/java/net/InetAddress.java
diff -u kaffe/libraries/javalib/java/net/InetAddress.java:1.18 kaffe/libraries/javalib/java/net/InetAddress.java:1.19
--- kaffe/libraries/javalib/java/net/InetAddress.java:1.18	Tue Oct 28 12:29:38 2003
+++ kaffe/libraries/javalib/java/net/InetAddress.java	Fri Oct 31 15:15:44 2003
@@ -749,14 +749,18 @@
 
     for (int i = 0; i < iplist.length; i++)
       {
-        if (iplist[i].length != 4)
+	if (iplist[i].length != 4 && iplist[i].length != 16)
           throw new UnknownHostException (hostname);
 
         // Don't store the hostname in order to force resolution of the
         // canonical names of these ip's when the user asks for the hostname
         // But do specify the host alias so if the IP returned won't
         // reverse lookup we don't throw an exception.
-        addresses[i] = new InetAddress (iplist[i], null, hostname);
+	// If the length is equal to 16 this is an IPv6 address.
+	if (iplist[i].length == 16)
+	  addresses[i] = new Inet6Address (iplist[i], hostname);
+	else
+	  addresses[i] = new InetAddress (iplist[i], null, hostname);
       }
 
     addToCache (hostname, addresses);