diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-02-05 21:05:10 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-02-05 21:05:10 +0000 |
commit | bad51fe007432d0741b7f6f7723bfe6869b661b8 (patch) | |
tree | bc2d76d288e194886393c8243db408f582f899c5 /libjava/classpath/java | |
parent | 15b3f4099d549c102dddb15df7fd1261bdbb8e0d (diff) | |
download | gcc-bad51fe007432d0741b7f6f7723bfe6869b661b8.tar.gz |
* java/net/Proxy.java (equals): Handle case where address==null.
(hashCode): Likewise.
(toString): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121609 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java')
-rw-r--r-- | libjava/classpath/java/net/Proxy.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libjava/classpath/java/net/Proxy.java b/libjava/classpath/java/net/Proxy.java index 7b4ef299206..6f9f1b65be5 100644 --- a/libjava/classpath/java/net/Proxy.java +++ b/libjava/classpath/java/net/Proxy.java @@ -1,5 +1,5 @@ /* Proxy.java -- Represends a proxy for a network connection - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2007 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -112,7 +112,8 @@ public class Proxy Proxy tmp = (Proxy) obj; return (type.equals(tmp.type) - && address.equals(tmp.address)); + && (address == null ? tmp.address == null + : address.equals(tmp.address))); } /** @@ -122,7 +123,7 @@ public class Proxy */ public final int hashCode() { - return type.hashCode() ^ address.hashCode(); + return type.hashCode() ^ (address == null ? 0 : address.hashCode()); } /** @@ -132,6 +133,7 @@ public class Proxy */ public String toString() { - return type.toString() + ":" + address.toString(); + return type.toString() + (address == null ? "" + : (":" + address.toString())); } } |