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

@ -294,7 +294,7 @@ public final class RouteTracker implements RouteInfo, Cloneable {
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 implements RouteInfo, Cloneable {
*/
@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;
}
/**

View File

@ -760,19 +760,15 @@ public class DefaultRequestDirector implements RequestDirector {
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 implements RequestDirector {
// 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.");
}