Avoid name hiding

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1571377 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2014-02-24 18:16:15 +00:00
parent fe360e7b3d
commit eaaa6fc3ed
5 changed files with 17 additions and 17 deletions

View File

@ -96,7 +96,7 @@ public class TestCacheValidityPolicy {
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(headers); final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(headers);
impl = new CacheValidityPolicy() { impl = new CacheValidityPolicy() {
@Override @Override
protected long getApparentAgeSecs(final HttpCacheEntry entry) { protected long getApparentAgeSecs(final HttpCacheEntry ent) {
return 6; return 6;
} }
}; };
@ -109,7 +109,7 @@ public class TestCacheValidityPolicy {
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(headers); final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(headers);
impl = new CacheValidityPolicy() { impl = new CacheValidityPolicy() {
@Override @Override
protected long getApparentAgeSecs(final HttpCacheEntry entry) { protected long getApparentAgeSecs(final HttpCacheEntry ent) {
return 10; return 10;
} }
}; };
@ -127,12 +127,12 @@ public class TestCacheValidityPolicy {
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(); final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry();
impl = new CacheValidityPolicy() { impl = new CacheValidityPolicy() {
@Override @Override
protected long getCorrectedReceivedAgeSecs(final HttpCacheEntry entry) { protected long getCorrectedReceivedAgeSecs(final HttpCacheEntry ent) {
return 7; return 7;
} }
@Override @Override
protected long getResponseDelaySecs(final HttpCacheEntry entry) { protected long getResponseDelaySecs(final HttpCacheEntry ent) {
return 13; return 13;
} }
}; };
@ -150,11 +150,11 @@ public class TestCacheValidityPolicy {
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(); final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry();
impl = new CacheValidityPolicy() { impl = new CacheValidityPolicy() {
@Override @Override
protected long getCorrectedInitialAgeSecs(final HttpCacheEntry entry) { protected long getCorrectedInitialAgeSecs(final HttpCacheEntry ent) {
return 11; return 11;
} }
@Override @Override
protected long getResidentTimeSecs(final HttpCacheEntry entry, final Date d) { protected long getResidentTimeSecs(final HttpCacheEntry ent, final Date d) {
return 17; return 17;
} }
}; };

View File

@ -164,8 +164,8 @@ public class BasicClientConnectionManager implements ClientConnectionManager {
} }
if (this.poolEntry == null) { if (this.poolEntry == null) {
final String id = Long.toString(COUNTER.getAndIncrement()); final String id = Long.toString(COUNTER.getAndIncrement());
final OperatedClientConnection conn = this.connOperator.createConnection(); final OperatedClientConnection opconn = this.connOperator.createConnection();
this.poolEntry = new HttpPoolEntry(this.log, id, route, conn, 0, TimeUnit.MILLISECONDS); this.poolEntry = new HttpPoolEntry(this.log, id, route, opconn, 0, TimeUnit.MILLISECONDS);
} }
final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis();
if (this.poolEntry.isExpired(now)) { if (this.poolEntry.isExpired(now)) {

View File

@ -84,7 +84,7 @@ public class RouteSpecificPool {
this.route = route; this.route = route;
this.maxEntries = maxEntries; this.maxEntries = maxEntries;
this.connPerRoute = new ConnPerRoute() { this.connPerRoute = new ConnPerRoute() {
public int getMaxForRoute(final HttpRoute route) { public int getMaxForRoute(final HttpRoute unused) {
return RouteSpecificPool.this.maxEntries; return RouteSpecificPool.this.maxEntries;
} }
}; };

View File

@ -80,10 +80,10 @@ public abstract class HttpRequestBase extends AbstractExecutionAwareRequest
public RequestLine getRequestLine() { public RequestLine getRequestLine() {
final String method = getMethod(); final String method = getMethod();
final ProtocolVersion ver = getProtocolVersion(); final ProtocolVersion ver = getProtocolVersion();
final URI uri = getURI(); final URI uriCopy = getURI(); // avoids possible window where URI could be changed
String uritext = null; String uritext = null;
if (uri != null) { if (uriCopy != null) {
uritext = uri.toASCIIString(); uritext = uriCopy.toASCIIString();
} }
if (uritext == null || uritext.isEmpty()) { if (uritext == null || uritext.isEmpty()) {
uritext = "/"; uritext = "/";

View File

@ -287,11 +287,11 @@ public class RequestBuilder {
public HttpUriRequest build() { public HttpUriRequest build() {
final HttpRequestBase result; final HttpRequestBase result;
URI uriNotNull = this.uri != null ? this.uri : URI.create("/"); URI uriNotNull = this.uri != null ? this.uri : URI.create("/");
HttpEntity entity = this.entity; HttpEntity entityCopy = this.entity;
if (parameters != null && !parameters.isEmpty()) { if (parameters != null && !parameters.isEmpty()) {
if (entity == null && (HttpPost.METHOD_NAME.equalsIgnoreCase(method) if (entityCopy == null && (HttpPost.METHOD_NAME.equalsIgnoreCase(method)
|| HttpPut.METHOD_NAME.equalsIgnoreCase(method))) { || HttpPut.METHOD_NAME.equalsIgnoreCase(method))) {
entity = new UrlEncodedFormEntity(parameters, HTTP.DEF_CONTENT_CHARSET); entityCopy = new UrlEncodedFormEntity(parameters, HTTP.DEF_CONTENT_CHARSET);
} else { } else {
try { try {
uriNotNull = new URIBuilder(uriNotNull).addParameters(parameters).build(); uriNotNull = new URIBuilder(uriNotNull).addParameters(parameters).build();
@ -300,11 +300,11 @@ public class RequestBuilder {
} }
} }
} }
if (entity == null) { if (entityCopy == null) {
result = new InternalRequest(method); result = new InternalRequest(method);
} else { } else {
final InternalEntityEclosingRequest request = new InternalEntityEclosingRequest(method); final InternalEntityEclosingRequest request = new InternalEntityEclosingRequest(method);
request.setEntity(entity); request.setEntity(entityCopy);
result = request; result = request;
} }
result.setProtocolVersion(this.version); result.setProtocolVersion(this.version);