+2005-02-02 David Daney <ddaney@avtrex.com>
+
+ * java/net/InetAddress.java (InetAddress): Make a private copy of
+ the address.
+ * java/net/Inet4Address.java (getAddress): Return a copy of the
+ address.
+ * java/net/Inet6Address.java (Inet6Address): Use private copy of
+ the address
+ (getAddress): Return a copy of the address.
+ (equals): Rewrote.
+
2005-02-02 Tom Tromey <tromey@redhat.com>
* Makefile.in: Rebuilt.
Inet6Address(byte[] addr, String host)
{
super(addr, host);
- this.ipaddress = addr;
+ // Super constructor clones the addr. Get a reference to the clone.
+ this.ipaddress = this.addr;
}
/**
*/
public byte[] getAddress()
{
- return ipaddress;
+ return (byte[]) ipaddress.clone();
}
/**
if (! (obj instanceof Inet6Address))
return false;
- Inet6Address tmp = (Inet6Address) obj;
-
- return super.equals(tmp) && this.ipaddress == tmp.ipaddress;
+ // this.ipaddress is never set in this class except to
+ // the value of the super class' addr. The super classes
+ // equals(Object) will do the compare.
+ return super.equals(obj);
}
/**