Code clean-ups

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1050152 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2010-12-16 20:42:22 +00:00
parent 3f3dc38dbb
commit eb0eab0a86
2 changed files with 18 additions and 30 deletions

View File

@ -315,26 +315,19 @@ public final class RouteTracker implements RouteInfo, Cloneable {
*/ */
@Override @Override
public final int hashCode() { public final int hashCode() {
int hash = LangUtils.HASH_SEED;
int hc = this.targetHost.hashCode(); hash = LangUtils.hashCode(hash, this.targetHost);
hash = LangUtils.hashCode(hash, this.localAddress);
if (this.localAddress != null)
hc ^= localAddress.hashCode();
if (this.proxyChain != null) { if (this.proxyChain != null) {
hc ^= proxyChain.length; for (int i = 0; i < this.proxyChain.length; i++) {
for (int i=0; i<proxyChain.length; i++) hash = LangUtils.hashCode(hash, this.proxyChain[i]);
hc ^= proxyChain[i].hashCode(); }
} }
hash = LangUtils.hashCode(hash, this.connected);
if (this.connected) hash = LangUtils.hashCode(hash, this.secure);
hc ^= 0x11111111; hash = LangUtils.hashCode(hash, this.tunnelled);
if (this.secure) hash = LangUtils.hashCode(hash, this.layered);
hc ^= 0x22222222; return hash;
hc ^= this.tunnelled.hashCode();
hc ^= this.layered.hashCode();
return hc;
} }
/** /**

View File

@ -760,19 +760,15 @@ public class DefaultRequestDirector implements RequestDirector {
break; break;
case HttpRouteDirector.UNREACHABLE: case HttpRouteDirector.UNREACHABLE:
throw new IllegalStateException throw new HttpException("Unable to establish route: " +
("Unable to establish route." + "planned = " + route + "; current = " + fact);
"\nplanned = " + route +
"\ncurrent = " + fact);
case HttpRouteDirector.COMPLETE: case HttpRouteDirector.COMPLETE:
// do nothing // do nothing
break; break;
default: default:
throw new IllegalStateException throw new IllegalStateException("Unknown step indicator "
("Unknown step indicator "+step+" from RouteDirector."); + step + " from RouteDirector.");
} // switch }
} while (step > HttpRouteDirector.COMPLETE); } while (step > HttpRouteDirector.COMPLETE);
@ -945,8 +941,7 @@ public class DefaultRequestDirector implements RequestDirector {
// complexity. Feel free to submit patches that refactor the code in // complexity. Feel free to submit patches that refactor the code in
// createTunnelToTarget to facilitate re-use for proxy tunnelling. // createTunnelToTarget to facilitate re-use for proxy tunnelling.
throw new UnsupportedOperationException throw new HttpException("Proxy chains are not supported.");
("Proxy chains are not supported.");
} }