Index: /home/oleg/src/apache.org/jakarta-commons/httpclient-trunk/src/java/org/apache/commons/httpclient/HostConfiguration.java =================================================================== --- /home/oleg/src/apache.org/jakarta-commons/httpclient-trunk/src/java/org/apache/commons/httpclient/HostConfiguration.java (revision 169846) +++ /home/oleg/src/apache.org/jakarta-commons/httpclient-trunk/src/java/org/apache/commons/httpclient/HostConfiguration.java (working copy) @@ -485,45 +485,15 @@ * @see java.lang.Object#equals(java.lang.Object) */ public synchronized boolean equals(final Object o) { - if (o instanceof HostConfiguration) { - // shortcut if we're comparing with ourselves if (o == this) { return true; } - HostConfiguration that = (HostConfiguration) o; - - if (this.host != null) { - if (!this.host.equals(that.host)) { - return false; - } - } else { - if (that.host != null) { - return false; - } - } - if (this.proxyHost != null) { - if (!this.proxyHost.equals(that.proxyHost)) { - return false; - } - } else { - if (that.proxyHost != null) { - return false; - } - } - if (localAddress != null) { - if (!localAddress.equals(that.getLocalAddress())) { - return false; - } - } else { - if (that.getLocalAddress() != null) { - return false; - } - } - // everything matches - return true; + return LangUtils.equals(this.host, that.host) + && LangUtils.equals(this.proxyHost, that.proxyHost) + && LangUtils.equals(this.localAddress, that.localAddress); } else { return false; } @@ -537,6 +507,7 @@ int hash = LangUtils.HASH_SEED; hash = LangUtils.hashCode(hash, this.host); hash = LangUtils.hashCode(hash, this.proxyHost); + hash = LangUtils.hashCode(hash, this.localAddress); return hash; }