diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheEntry.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheEntry.java index ca251351e..9dcaca83a 100644 --- a/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheEntry.java +++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheEntry.java @@ -228,7 +228,7 @@ public class HttpCacheEntry implements Serializable { public Map getVariantMap() { if (variantMap == null) { throw new UnsupportedOperationException("variant maps not" + - "supported if constructed with deprecated variant set"); + "supported if constructed with deprecated variant set"); } return Collections.unmodifiableMap(variantMap); } diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntryUpdater.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntryUpdater.java index 985fecd9a..f2233273d 100644 --- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntryUpdater.java +++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntryUpdater.java @@ -100,12 +100,12 @@ class CacheEntryUpdater { if (entryAndResponseHaveDateHeader(entry, response) && entryDateHeaderNewerThenResponse(entry, response)) { - // Don't merge headers, keep the entry's headers as they are newer. - return entry.getAllHeaders(); + // Don't merge headers, keep the entry's headers as they are newer. + return entry.getAllHeaders(); } List
cacheEntryHeaderList = new ArrayList
(Arrays.asList(entry - .getAllHeaders())); + .getAllHeaders())); removeCacheHeadersThatMatchResponse(cacheEntryHeaderList, response); removeCacheEntry1xxWarnings(cacheEntryHeaderList, entry); cacheEntryHeaderList.addAll(Arrays.asList(response.getAllHeaders())); diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java index 6bdaa0bf2..45a0dae77 100644 --- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java +++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java @@ -666,8 +666,8 @@ public class CachingHttpClient implements HttpClient { } - private boolean revalidationResponseIsTooOld(HttpResponse backendResponse, - HttpCacheEntry cacheEntry) { + private boolean revalidationResponseIsTooOld(HttpResponse backendResponse, + HttpCacheEntry cacheEntry) { final Header entryDateHeader = cacheEntry.getFirstHeader("Date"); final Header responseDateHeader = backendResponse.getFirstHeader("Date"); if (entryDateHeader != null && responseDateHeader != null) { @@ -682,8 +682,8 @@ public class CachingHttpClient implements HttpClient { // unconditional retry recommended in 13.2.6 of RFC 2616. } } - return false; - } + return false; + } HttpResponse negotiateResponseFromVariants(HttpHost target, HttpRequest request, HttpContext context, @@ -716,7 +716,7 @@ public class CachingHttpClient implements HttpClient { HttpCacheEntry matchedEntry = matchingVariant.getEntry(); if (revalidationResponseIsTooOld(backendResponse, matchedEntry)) { - return retryRequestUnconditionally(target, request, context, + return retryRequestUnconditionally(target, request, context, matchedEntry); } @@ -740,7 +740,7 @@ public class CachingHttpClient implements HttpClient { HttpRequest request, HttpContext context, HttpCacheEntry matchedEntry) throws IOException { HttpRequest unconditional = conditionalRequestBuilder - .buildUnconditionalRequest(request, matchedEntry); + .buildUnconditionalRequest(request, matchedEntry); return callBackend(target, unconditional, context); } @@ -779,18 +779,18 @@ public class CachingHttpClient implements HttpClient { HttpContext context, HttpCacheEntry cacheEntry) throws IOException, ProtocolException { - HttpRequest conditionalRequest = conditionalRequestBuilder.buildConditionalRequest(request, cacheEntry); + HttpRequest conditionalRequest = conditionalRequestBuilder.buildConditionalRequest(request, cacheEntry); Date requestDate = getCurrentDate(); HttpResponse backendResponse = backend.execute(target, conditionalRequest, context); Date responseDate = getCurrentDate(); if (revalidationResponseIsTooOld(backendResponse, cacheEntry)) { - HttpRequest unconditional = conditionalRequestBuilder - .buildUnconditionalRequest(request, cacheEntry); - requestDate = getCurrentDate(); - backendResponse = backend.execute(target, unconditional, context); - responseDate = getCurrentDate(); + HttpRequest unconditional = conditionalRequestBuilder + .buildUnconditionalRequest(request, cacheEntry); + requestDate = getCurrentDate(); + backendResponse = backend.execute(target, unconditional, context); + responseDate = getCurrentDate(); } backendResponse.addHeader("Via", generateViaHeader(backendResponse)); @@ -822,11 +822,11 @@ public class CachingHttpClient implements HttpClient { backendResponse); } - private boolean staleIfErrorAppliesTo(int statusCode) { - return statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR - || statusCode == HttpStatus.SC_BAD_GATEWAY - || statusCode == HttpStatus.SC_SERVICE_UNAVAILABLE - || statusCode == HttpStatus.SC_GATEWAY_TIMEOUT; + private boolean staleIfErrorAppliesTo(int statusCode) { + return statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR + || statusCode == HttpStatus.SC_BAD_GATEWAY + || statusCode == HttpStatus.SC_SERVICE_UNAVAILABLE + || statusCode == HttpStatus.SC_GATEWAY_TIMEOUT; } HttpResponse handleBackendResponse( diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/Variant.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/Variant.java index c99e59e73..0eabe680b 100644 --- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/Variant.java +++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/Variant.java @@ -31,25 +31,25 @@ import org.apache.http.client.cache.HttpCacheEntry; /** Records a set of information describing a cached variant. */ class Variant { - private final String variantKey; - private final String cacheKey; - private final HttpCacheEntry entry; + private final String variantKey; + private final String cacheKey; + private final HttpCacheEntry entry; - public Variant(String variantKey, String cacheKey, HttpCacheEntry entry) { - this.variantKey = variantKey; - this.cacheKey = cacheKey; - this.entry = entry; - } + public Variant(String variantKey, String cacheKey, HttpCacheEntry entry) { + this.variantKey = variantKey; + this.cacheKey = cacheKey; + this.entry = entry; + } - public String getVariantKey() { - return variantKey; - } - - public String getCacheKey() { - return cacheKey; - } - - public HttpCacheEntry getEntry() { - return entry; - } + public String getVariantKey() { + return variantKey; + } + + public String getCacheKey() { + return cacheKey; + } + + public HttpCacheEntry getEntry() { + return entry; + } } diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/WarningValue.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/WarningValue.java index 2c3c703ec..076c4c8ac 100644 --- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/WarningValue.java +++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/WarningValue.java @@ -208,7 +208,7 @@ class WarningValue { char c = src.charAt(offs); if (offs + 1 < src.length() && c == '\\' && isChar(src.charAt(offs+1))) { - offs += 2; // consume quoted-pair + offs += 2; // consume quoted-pair } else if (c == '\"') { foundEnd = true; offs++; diff --git a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java index 24b5f38d8..83308a4b4 100644 --- a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java +++ b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java @@ -5549,7 +5549,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest { private void assertValidViaHeader(String via) { - // Via = "Via" ":" 1#( received-protocol received-by [ comment ] ) + // Via = "Via" ":" 1#( received-protocol received-by [ comment ] ) // received-protocol = [ protocol-name "/" ] protocol-version // protocol-name = token // protocol-version = token diff --git a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestRFC5861Compliance.java b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestRFC5861Compliance.java index 986f2291a..58de0a610 100644 --- a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestRFC5861Compliance.java +++ b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestRFC5861Compliance.java @@ -45,7 +45,7 @@ import org.junit.Test; */ public class TestRFC5861Compliance extends AbstractProtocolTest { - /* + /* * "The stale-if-error Cache-Control extension indicates that when an * error is encountered, a cached stale response MAY be used to satisfy * the request, regardless of other freshness information.When used as a @@ -62,11 +62,11 @@ public class TestRFC5861Compliance extends AbstractProtocolTest { */ @Test public void testStaleIfErrorInResponseIsTrueReturnsStaleEntryWithWarning() - throws Exception{ + throws Exception{ Date tenSecondsAgo = new Date(new Date().getTime() - 10 * 1000L); HttpRequest req1 = HttpTestUtils.makeDefaultRequest(); HttpResponse resp1 = HttpTestUtils.make200Response(tenSecondsAgo, - "public, max-age=5, stale-if-error=60"); + "public, max-age=5, stale-if-error=60"); backendExpectsAnyRequest().andReturn(resp1); @@ -183,11 +183,11 @@ public class TestRFC5861Compliance extends AbstractProtocolTest { @Test public void testStaleIfErrorInRequestIsTrueReturnsStaleEntryWithWarning() - throws Exception{ + throws Exception{ Date tenSecondsAgo = new Date(new Date().getTime() - 10 * 1000L); HttpRequest req1 = HttpTestUtils.makeDefaultRequest(); HttpResponse resp1 = HttpTestUtils.make200Response(tenSecondsAgo, - "public, max-age=5"); + "public, max-age=5"); backendExpectsAnyRequest().andReturn(resp1); @@ -207,12 +207,12 @@ public class TestRFC5861Compliance extends AbstractProtocolTest { @Test public void testStaleIfErrorInResponseIsFalseReturnsError() - throws Exception{ - Date now = new Date(); + throws Exception{ + Date now = new Date(); Date tenSecondsAgo = new Date(now.getTime() - 10 * 1000L); HttpRequest req1 = HttpTestUtils.makeDefaultRequest(); HttpResponse resp1 = HttpTestUtils.make200Response(tenSecondsAgo, - "public, max-age=5, stale-if-error=2"); + "public, max-age=5, stale-if-error=2"); backendExpectsAnyRequest().andReturn(resp1); @@ -232,12 +232,12 @@ public class TestRFC5861Compliance extends AbstractProtocolTest { @Test public void testStaleIfErrorInRequestIsFalseReturnsError() - throws Exception{ - Date now = new Date(); + throws Exception{ + Date now = new Date(); Date tenSecondsAgo = new Date(now.getTime() - 10 * 1000L); HttpRequest req1 = HttpTestUtils.makeDefaultRequest(); HttpResponse resp1 = HttpTestUtils.make200Response(tenSecondsAgo, - "public, max-age=5"); + "public, max-age=5"); backendExpectsAnyRequest().andReturn(resp1);