diff options
author | daney <daney@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-03 17:44:20 +0000 |
---|---|---|
committer | daney <daney@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-03 17:44:20 +0000 |
commit | 30dab0fae3aeffb93c2a49a77003d6f89ce5ec95 (patch) | |
tree | 9b69152f633ffbb0192b4b1ab1aa7f6cd64f6d8e /libjava/java/net/Inet6Address.java | |
parent | fd5a85b4a3a1f56a785ea047be3bc9e6623f9375 (diff) | |
download | ppe42-gcc-30dab0fae3aeffb93c2a49a77003d6f89ce5ec95.tar.gz ppe42-gcc-30dab0fae3aeffb93c2a49a77003d6f89ce5ec95.zip |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94664 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/net/Inet6Address.java')
-rw-r--r-- | libjava/java/net/Inet6Address.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libjava/java/net/Inet6Address.java b/libjava/java/net/Inet6Address.java index 0c1d60e8edf..69d266a4c17 100644 --- a/libjava/java/net/Inet6Address.java +++ b/libjava/java/net/Inet6Address.java @@ -65,7 +65,8 @@ public final class Inet6Address extends InetAddress 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; } /** @@ -194,7 +195,7 @@ public final class Inet6Address extends InetAddress */ public byte[] getAddress() { - return ipaddress; + return (byte[]) ipaddress.clone(); } /** @@ -233,9 +234,10 @@ public final class Inet6Address extends InetAddress 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); } /** |