/[Apache-SVN]/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/HostConfiguration.java
ViewVC logotype

Diff of /jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/HostConfiguration.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/HostConfiguration.java	2005/06/01 22:13:16	179432
+++ jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/HostConfiguration.java	2005/06/01 22:16:28	179433
@@ -485,45 +485,15 @@ public class HostConfiguration implement
      * @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 @@ public class HostConfiguration implement
         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;
     }
 

 

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26