You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2010/12/16 21:42:23 UTC
svn commit: r1050152 - in
/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http:
conn/routing/RouteTracker.java impl/client/DefaultRequestDirector.java
Author: olegk
Date: Thu Dec 16 20:42:22 2010
New Revision: 1050152
URL: http://svn.apache.org/viewvc?rev=1050152&view=rev
Log:
Code clean-ups
Modified:
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/RouteTracker.java
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/RouteTracker.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/RouteTracker.java?rev=1050152&r1=1050151&r2=1050152&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/RouteTracker.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/RouteTracker.java Thu Dec 16 20:42:22 2010
@@ -294,7 +294,7 @@ public final class RouteTracker implemen
return false;
RouteTracker that = (RouteTracker) o;
- return
+ return
// Do the cheapest checks first
(this.connected == that.connected) &&
(this.secure == that.secure) &&
@@ -315,26 +315,19 @@ public final class RouteTracker implemen
*/
@Override
public final int hashCode() {
-
- int hc = this.targetHost.hashCode();
-
- if (this.localAddress != null)
- hc ^= localAddress.hashCode();
+ int hash = LangUtils.HASH_SEED;
+ hash = LangUtils.hashCode(hash, this.targetHost);
+ hash = LangUtils.hashCode(hash, this.localAddress);
if (this.proxyChain != null) {
- hc ^= proxyChain.length;
- for (int i=0; i<proxyChain.length; i++)
- hc ^= proxyChain[i].hashCode();
+ for (int i = 0; i < this.proxyChain.length; i++) {
+ hash = LangUtils.hashCode(hash, this.proxyChain[i]);
+ }
}
-
- if (this.connected)
- hc ^= 0x11111111;
- if (this.secure)
- hc ^= 0x22222222;
-
- hc ^= this.tunnelled.hashCode();
- hc ^= this.layered.hashCode();
-
- return hc;
+ hash = LangUtils.hashCode(hash, this.connected);
+ hash = LangUtils.hashCode(hash, this.secure);
+ hash = LangUtils.hashCode(hash, this.tunnelled);
+ hash = LangUtils.hashCode(hash, this.layered);
+ return hash;
}
/**
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java?rev=1050152&r1=1050151&r2=1050152&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java Thu Dec 16 20:42:22 2010
@@ -760,19 +760,15 @@ public class DefaultRequestDirector impl
break;
case HttpRouteDirector.UNREACHABLE:
- throw new IllegalStateException
- ("Unable to establish route." +
- "\nplanned = " + route +
- "\ncurrent = " + fact);
-
+ throw new HttpException("Unable to establish route: " +
+ "planned = " + route + "; current = " + fact);
case HttpRouteDirector.COMPLETE:
// do nothing
break;
-
default:
- throw new IllegalStateException
- ("Unknown step indicator "+step+" from RouteDirector.");
- } // switch
+ throw new IllegalStateException("Unknown step indicator "
+ + step + " from RouteDirector.");
+ }
} while (step > HttpRouteDirector.COMPLETE);
@@ -945,8 +941,7 @@ public class DefaultRequestDirector impl
// complexity. Feel free to submit patches that refactor the code in
// createTunnelToTarget to facilitate re-use for proxy tunnelling.
- throw new UnsupportedOperationException
- ("Proxy chains are not supported.");
+ throw new HttpException("Proxy chains are not supported.");
}