Commit 9e006df6 by Tom Tromey Committed by Tom Tromey

Proxy.java (equals): Handle case where address==null.

	* java/net/Proxy.java (equals): Handle case where address==null.
	(hashCode): Likewise.
	(toString): Likewise.

From-SVN: r121609
parent 072d019d
2007-02-05 Tom Tromey <tromey@redhat.com>
* java/net/Proxy.java (equals): Handle case where address==null.
(hashCode): Likewise.
(toString): Likewise.
2007-01-31 Tom Tromey <tromey@redhat.com> 2007-01-31 Tom Tromey <tromey@redhat.com>
* resource/gnu/classpath/tools/jar/messages.properties * resource/gnu/classpath/tools/jar/messages.properties
/* Proxy.java -- Represends a proxy for a network connection /* 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. This file is part of GNU Classpath.
...@@ -112,7 +112,8 @@ public class Proxy ...@@ -112,7 +112,8 @@ public class Proxy
Proxy tmp = (Proxy) obj; Proxy tmp = (Proxy) obj;
return (type.equals(tmp.type) 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 ...@@ -122,7 +123,7 @@ public class Proxy
*/ */
public final int hashCode() public final int hashCode()
{ {
return type.hashCode() ^ address.hashCode(); return type.hashCode() ^ (address == null ? 0 : address.hashCode());
} }
/** /**
...@@ -132,6 +133,7 @@ public class Proxy ...@@ -132,6 +133,7 @@ public class Proxy
*/ */
public String toString() public String toString()
{ {
return type.toString() + ":" + address.toString(); return type.toString() + (address == null ? ""
: (":" + address.toString()));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment