Inet6Address.java (getHostAddress): Fix textual representation of IPv6 address with...
authorMattias Rehnberg <Mattias.Rehnberg@home.se>
Thu, 18 Nov 2004 16:11:40 +0000 (17:11 +0100)
committerMichael Koch <mkoch@gcc.gnu.org>
Thu, 18 Nov 2004 16:11:40 +0000 (16:11 +0000)
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.

From-SVN: r90874

libjava/ChangeLog
libjava/java/net/Inet6Address.java

index f475b05b335cb803835d2d8b74d246fa54dfb2c2..5153b6c45151816d117e516975c89ea49150eeed 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2004-11-18  Jeroen Frijters  <address@bogus.example.com>
 
        * java/lang/StackTraceElement.java: Made final.
index e0329d5214c6d2eae42bfa676ba733ad9ac31d41..0c1d60e8edf8dedadf98a76d46b95b4099c27af0 100644 (file)
@@ -207,18 +207,11 @@ public final class Inet6Address extends InetAddress
     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();