hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1044366 - in /httpcomponents/httpclient/trunk: RELEASE_NOTES.txt httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java
Date Fri, 10 Dec 2010 14:15:54 GMT
Author: sebb
Date: Fri Dec 10 14:15:54 2010
New Revision: 1044366

URL: http://svn.apache.org/viewvc?rev=1044366&view=rev
Log:
[HTTPCLIENT-1030] HttpRoute.equals(Object o) is quite inefficient, as it does not take full
advantage of shortcut logic

Modified:
    httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java

Modified: httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt?rev=1044366&r1=1044365&r2=1044366&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/trunk/RELEASE_NOTES.txt Fri Dec 10 14:15:54 2010
@@ -1,7 +1,10 @@
 Changes since 4.1 BETA1
 -----------------------
 
-* [HTTPCLIENT-1030) Implement "ignoreCookies" CookieSpec
+* [HTTPCLIENT-1030] HttpRoute.equals(Object o) is quite inefficient, as it does not take
full advantage of shortcut logic
+ Contributed by Sebastian Bazley <sebb at apache.org>
+
+* [HTTPCLIENT-1030] Implement "ignoreCookies" CookieSpec
  Contributed by Sebastian Bazley <sebb at apache.org>
 
 Release 4.1 BETA1

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java?rev=1044366&r1=1044365&r2=1044366&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java
Fri Dec 10 14:15:54 2010
@@ -336,27 +336,31 @@ public final class HttpRoute implements 
             return false;
 
         HttpRoute that = (HttpRoute) o;
-        boolean equal = this.targetHost.equals(that.targetHost);
-        equal &=
-            ( this.localAddress == that.localAddress) ||
-            ((this.localAddress != null) &&
-              this.localAddress.equals(that.localAddress));
-        equal &=
-            ( this.proxyChain        == that.proxyChain) ||
-            ( this.proxyChain.length == that.proxyChain.length);
-        // comparison of actual proxies follows below
-        equal &=
+        
+        if (
+            this.targetHost.equals(that.targetHost) &&
+            (  ( this.localAddress == that.localAddress) ||
+              (( this.localAddress != null) &&
+                 this.localAddress.equals(that.localAddress)) 
+            ) &&
+            ( ( this.proxyChain        == that.proxyChain) ||
+              ( this.proxyChain.length == that.proxyChain.length)
+              // comparison of actual proxies follows below
+            ) &&
             (this.secure    == that.secure) &&
             (this.tunnelled == that.tunnelled) &&
-            (this.layered   == that.layered);
-
-        // chain length has been compared above, now check the proxies
-        if (equal && (this.proxyChain != null)) {
-            for (int i=0; equal && (i<this.proxyChain.length); i++)
-                equal = this.proxyChain[i].equals(that.proxyChain[i]);
+            (this.layered   == that.layered)
+            ) {
+            boolean equal = true;
+            // chain length has been compared above, now check the proxies
+            if (this.proxyChain != null) {
+                for (int i=0; equal && (i<this.proxyChain.length); i++)
+                    equal = this.proxyChain[i].equals(that.proxyChain[i]);
+            }
+            return equal;
+        } else {
+            return false;
         }
-
-        return equal;
     }
 
 



Mime
View raw message