[Patch] java.net.Inet6Address merged

Michael Koch konqueror@gmx.de
Thu Nov 18 18:18:00 GMT 2004


Hi list,


I just commited the attached patch to merge it from GNU classpath.


Michael


2004-11-18  Mattias Rehnberg  <Mattias.Rehnberg@home.se>

	* java/net/Inet6Address.java (getHostAddress): Fix textual
	representation of IPv6 address with embedded zeroes
	to conform to RFC 2373.

-------------- next part --------------
Index: java/net/Inet6Address.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/Inet6Address.java,v
retrieving revision 1.8
diff -u -r1.8 Inet6Address.java
--- java/net/Inet6Address.java	18 Oct 2004 12:36:27 -0000	1.8
+++ java/net/Inet6Address.java	18 Nov 2004 16:11:09 -0000
@@ -207,18 +207,11 @@
     for (int i = 0; i < 16; i += 2)
       {
 	int x = ((ipaddress[i] & 0xFF) << 8) | (ipaddress[i + 1] & 0xFF);
-	boolean empty = sbuf.length() == 0;
 
-	if (empty)
-	  {
-	    if (i > 0)
-	      sbuf.append("::");
-	  }
-	else
+	if (i > 0)
 	  sbuf.append(':');
 
-	if (x != 0 || i >= 14)
-	  sbuf.append(Integer.toHexString(x));
+	sbuf.append(Integer.toHexString(x));
       }
 
     return sbuf.toString();


More information about the Java-patches mailing list