]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* java/net/Proxy.java (equals): Handle case where address==null.
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 Feb 2007 21:05:10 +0000 (21:05 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 Feb 2007 21:05:10 +0000 (21:05 +0000)
(hashCode): Likewise.
(toString): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121609 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/classpath/ChangeLog
libjava/classpath/java/net/Proxy.java
libjava/classpath/lib/java/net/Proxy.class

index bcba0a9385d78377cdd90d67b4d77ec18347b109..f82f64ab993e54231806fd11434a8e17fca343d6 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
        * resource/gnu/classpath/tools/jar/messages.properties
index 7b4ef2992067a56c4017da2df276f90eefc41ab6..6f9f1b65be53cadae2555140469a23b633b74682 100644 (file)
@@ -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()));
   }
 }
index 9c7f6d87abdcf7d15c5fdba974e929fac1f7bd22..4da6ba2fdac9f3d4caf5b364e517bdb68b509cd4 100644 (file)
Binary files a/libjava/classpath/lib/java/net/Proxy.class and b/libjava/classpath/lib/java/net/Proxy.class differ