From 9e006df67f9d95371e7074bacd72625bba0fc0cd Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 5 Feb 2007 21:05:10 +0000 Subject: 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 --- libjava/classpath/java/net/Proxy.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libjava/classpath/java') diff --git a/libjava/classpath/java/net/Proxy.java b/libjava/classpath/java/net/Proxy.java index 7b4ef29..6f9f1b6 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())); } } -- cgit v1.1