I'm checking this in to Classpath, gcc svn trunk, and the RH 4.1
branch.
java.net.Proxy has to work when address==null. This was found by
Andrew Overholt when trying Eclipse Mylar.
Tom
Index: ChangeLog
from Tom Tromey <[EMAIL PROTECTED]>
* java/net/Proxy.java (equals): Handle case where address==null.
(hashCode): Likewise.
(toString): Likewise.
Index: java/net/Proxy.java
===================================================================
--- java/net/Proxy.java (revision 121470)
+++ java/net/Proxy.java (working copy)
@@ -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 @@
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 final int hashCode()
{
- return type.hashCode() ^ address.hashCode();
+ return type.hashCode() ^ (address == null ? 0 : address.hashCode());
}
/**
@@ -132,6 +133,7 @@
*/
public String toString()
{
- return type.toString() + ":" + address.toString();
+ return type.toString() + (address == null ? ""
+ : (":" + address.toString()));
}
}