hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1433569 [3/12] - in /httpcomponents: benchmark/httpcore/trunk/src/main/java/org/apache/http/benchmark/ benchmark/httpcore/trunk/src/main/java/org/apache/http/benchmark/httpcore/ benchmark/httpcore/trunk/src/main/java/org/apache/http/benchm...
Date Tue, 15 Jan 2013 18:30:06 GMT
Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntryUpdater.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntryUpdater.java?rev=1433569&r1=1433568&r2=1433569&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntryUpdater.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntryUpdater.java Tue Jan 15 18:29:58 2013
@@ -80,11 +80,11 @@ class CacheEntryUpdater {
      * @throws java.io.IOException if something bad happens while trying to read the body from the original entry
      */
     public HttpCacheEntry updateCacheEntry(
-            String requestId,
-            HttpCacheEntry entry,
-            Date requestDate,
-            Date responseDate,
-            HttpResponse response) throws IOException {
+            final String requestId,
+            final HttpCacheEntry entry,
+            final Date requestDate,
+            final Date responseDate,
+            final HttpResponse response) throws IOException {
         Args.check(response.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_MODIFIED,
                 "Response must have 304 status code");
         Header[] mergedHeaders = mergeHeaders(entry, response);
@@ -102,7 +102,7 @@ class CacheEntryUpdater {
                 resource);
     }
 
-    protected Header[] mergeHeaders(HttpCacheEntry entry, HttpResponse response) {
+    protected Header[] mergeHeaders(final HttpCacheEntry entry, final HttpResponse response) {
 
         if (entryAndResponseHaveDateHeader(entry, response)
                 && entryDateHeaderNewerThenResponse(entry, response)) {
@@ -119,8 +119,8 @@ class CacheEntryUpdater {
         return cacheEntryHeaderList.toArray(new Header[cacheEntryHeaderList.size()]);
     }
 
-    private void removeCacheHeadersThatMatchResponse(List<Header> cacheEntryHeaderList,
-            HttpResponse response) {
+    private void removeCacheHeadersThatMatchResponse(final List<Header> cacheEntryHeaderList,
+            final HttpResponse response) {
         for (Header responseHeader : response.getAllHeaders()) {
             ListIterator<Header> cacheEntryHeaderListIter = cacheEntryHeaderList.listIterator();
 
@@ -134,7 +134,7 @@ class CacheEntryUpdater {
         }
     }
 
-    private void removeCacheEntry1xxWarnings(List<Header> cacheEntryHeaderList, HttpCacheEntry entry) {
+    private void removeCacheEntry1xxWarnings(final List<Header> cacheEntryHeaderList, final HttpCacheEntry entry) {
         ListIterator<Header> cacheEntryHeaderListIter = cacheEntryHeaderList.listIterator();
 
         while (cacheEntryHeaderListIter.hasNext()) {
@@ -150,7 +150,7 @@ class CacheEntryUpdater {
         }
     }
 
-    private boolean entryDateHeaderNewerThenResponse(HttpCacheEntry entry, HttpResponse response) {
+    private boolean entryDateHeaderNewerThenResponse(final HttpCacheEntry entry, final HttpResponse response) {
         try {
             Date entryDate = DateUtils.parseDate(entry.getFirstHeader(HTTP.DATE_HEADER)
                     .getValue());
@@ -167,7 +167,7 @@ class CacheEntryUpdater {
         return true;
     }
 
-    private boolean entryAndResponseHaveDateHeader(HttpCacheEntry entry, HttpResponse response) {
+    private boolean entryAndResponseHaveDateHeader(final HttpCacheEntry entry, final HttpResponse response) {
         if (entry.getFirstHeader(HTTP.DATE_HEADER) != null
                 && response.getFirstHeader(HTTP.DATE_HEADER) != null) {
             return true;

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java?rev=1433569&r1=1433568&r2=1433569&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheInvalidator.java Tue Jan 15 18:29:58 2013
@@ -80,7 +80,7 @@ class CacheInvalidator {
      * @param host The backend host we are talking to
      * @param req The HttpRequest to that host
      */
-    public void flushInvalidatedCacheEntries(HttpHost host, HttpRequest req)  {
+    public void flushInvalidatedCacheEntries(final HttpHost host, final HttpRequest req)  {
         if (requestShouldNotBeCached(req)) {
             log.debug("Request should not be cached");
 
@@ -115,7 +115,7 @@ class CacheInvalidator {
         }
     }
 
-    private void flushEntry(String uri) {
+    private void flushEntry(final String uri) {
         try {
             storage.removeEntry(uri);
         } catch (IOException ioe) {
@@ -123,7 +123,7 @@ class CacheInvalidator {
         }
     }
 
-    private HttpCacheEntry getEntry(String theUri) {
+    private HttpCacheEntry getEntry(final String theUri) {
         try {
             return storage.getEntry(theUri);
         } catch (IOException ioe) {
@@ -132,7 +132,7 @@ class CacheInvalidator {
         return null;
     }
 
-    protected void flushUriIfSameHost(URL requestURL, URL targetURL) {
+    protected void flushUriIfSameHost(final URL requestURL, final URL targetURL) {
         URL canonicalTarget = getAbsoluteURL(cacheKeyGenerator.canonicalizeUri(targetURL.toString()));
         if (canonicalTarget == null) {
 			return;
@@ -142,7 +142,7 @@ class CacheInvalidator {
         }
     }
 
-    protected void flushRelativeUriFromSameHost(URL reqURL, String relUri) {
+    protected void flushRelativeUriFromSameHost(final URL reqURL, final String relUri) {
         URL relURL = getRelativeURL(reqURL, relUri);
         if (relURL == null) {
 			return;
@@ -151,7 +151,7 @@ class CacheInvalidator {
     }
 
 
-    protected boolean flushAbsoluteUriFromSameHost(URL reqURL, String uri) {
+    protected boolean flushAbsoluteUriFromSameHost(final URL reqURL, final String uri) {
         URL absURL = getAbsoluteURL(uri);
         if (absURL == null) {
 			return false;
@@ -160,7 +160,7 @@ class CacheInvalidator {
         return true;
     }
 
-    private URL getAbsoluteURL(String uri) {
+    private URL getAbsoluteURL(final String uri) {
         URL absURL = null;
         try {
             absURL = new URL(uri);
@@ -170,7 +170,7 @@ class CacheInvalidator {
         return absURL;
     }
 
-    private URL getRelativeURL(URL reqURL, String relUri) {
+    private URL getRelativeURL(final URL reqURL, final String relUri) {
         URL relURL = null;
         try {
             relURL = new URL(reqURL,relUri);
@@ -180,12 +180,12 @@ class CacheInvalidator {
         return relURL;
     }
 
-    protected boolean requestShouldNotBeCached(HttpRequest req) {
+    protected boolean requestShouldNotBeCached(final HttpRequest req) {
         String method = req.getRequestLine().getMethod();
         return notGetOrHeadRequest(method);
     }
 
-    private boolean notGetOrHeadRequest(String method) {
+    private boolean notGetOrHeadRequest(final String method) {
         return !(HeaderConstants.GET_METHOD.equals(method) || HeaderConstants.HEAD_METHOD
                 .equals(method));
     }
@@ -193,8 +193,8 @@ class CacheInvalidator {
     /** Flushes entries that were invalidated by the given response
      * received for the given host/request pair.
      */
-    public void flushInvalidatedCacheEntries(HttpHost host,
-            HttpRequest request, HttpResponse response) {
+    public void flushInvalidatedCacheEntries(final HttpHost host,
+            final HttpRequest request, final HttpResponse response) {
         int status = response.getStatusLine().getStatusCode();
         if (status < 200 || status > 299) {
 			return;
@@ -226,7 +226,7 @@ class CacheInvalidator {
         flushUriIfSameHost(reqURL, canonURL);
     }
 
-    private URL getContentLocationURL(URL reqURL, HttpResponse response) {
+    private URL getContentLocationURL(final URL reqURL, final HttpResponse response) {
         Header clHeader = response.getFirstHeader("Content-Location");
         if (clHeader == null) {
 			return null;
@@ -239,8 +239,8 @@ class CacheInvalidator {
         return getRelativeURL(reqURL, contentLocation);
     }
 
-    private boolean responseAndEntryEtagsDiffer(HttpResponse response,
-            HttpCacheEntry entry) {
+    private boolean responseAndEntryEtagsDiffer(final HttpResponse response,
+            final HttpCacheEntry entry) {
         Header entryEtag = entry.getFirstHeader(HeaderConstants.ETAG);
         Header responseEtag = response.getFirstHeader(HeaderConstants.ETAG);
         if (entryEtag == null || responseEtag == null) {
@@ -249,8 +249,8 @@ class CacheInvalidator {
         return (!entryEtag.getValue().equals(responseEtag.getValue()));
     }
 
-    private boolean responseDateOlderThanEntryDate(HttpResponse response,
-            HttpCacheEntry entry) {
+    private boolean responseDateOlderThanEntryDate(final HttpResponse response,
+            final HttpCacheEntry entry) {
         Header entryDateHeader = entry.getFirstHeader(HTTP.DATE_HEADER);
         Header responseDateHeader = response.getFirstHeader(HTTP.DATE_HEADER);
         if (entryDateHeader == null || responseDateHeader == null) {

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheKeyGenerator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheKeyGenerator.java?rev=1433569&r1=1433568&r2=1433569&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheKeyGenerator.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheKeyGenerator.java Tue Jan 15 18:29:58 2013
@@ -60,14 +60,14 @@ class CacheKeyGenerator {
      * @param req the {@link HttpRequest}
      * @return String the extracted URI
      */
-    public String getURI(HttpHost host, HttpRequest req) {
+    public String getURI(final HttpHost host, final HttpRequest req) {
         if (isRelativeRequest(req)) {
             return canonicalizeUri(String.format("%s%s", host.toString(), req.getRequestLine().getUri()));
         }
         return canonicalizeUri(req.getRequestLine().getUri());
     }
 
-    public String canonicalizeUri(String uri) {
+    public String canonicalizeUri(final String uri) {
         try {
             URL u = new URL(uri);
             String protocol = u.getProtocol().toLowerCase();
@@ -86,7 +86,7 @@ class CacheKeyGenerator {
         }
     }
 
-    private String canonicalizePath(String path) {
+    private String canonicalizePath(final String path) {
         try {
             String decoded = URLDecoder.decode(path, "UTF-8");
             return (new URI(decoded)).getPath();
@@ -96,7 +96,7 @@ class CacheKeyGenerator {
         return path;
     }
 
-    private int canonicalizePort(int port, String protocol) {
+    private int canonicalizePort(final int port, final String protocol) {
         if (port == -1 && "http".equalsIgnoreCase(protocol)) {
             return 80;
         } else if (port == -1 && "https".equalsIgnoreCase(protocol)) {
@@ -105,12 +105,12 @@ class CacheKeyGenerator {
         return port;
     }
 
-    private boolean isRelativeRequest(HttpRequest req) {
+    private boolean isRelativeRequest(final HttpRequest req) {
         String requestUri = req.getRequestLine().getUri();
         return ("*".equals(requestUri) || requestUri.startsWith("/"));
     }
 
-    protected String getFullHeaderValue(Header[] headers) {
+    protected String getFullHeaderValue(final Header[] headers) {
         if (headers == null) {
 			return "";
 		}
@@ -138,7 +138,7 @@ class CacheKeyGenerator {
      * @param entry the parent entry used to track the variants
      * @return String the extracted variant URI
      */
-    public String getVariantURI(HttpHost host, HttpRequest req, HttpCacheEntry entry) {
+    public String getVariantURI(final HttpHost host, final HttpRequest req, final HttpCacheEntry entry) {
         if (!entry.hasVariants()) {
 			return getURI(host, req);
 		}
@@ -154,7 +154,7 @@ class CacheKeyGenerator {
      * @param entry cache entry in question that has variants
      * @return a <code>String</code> variant key
      */
-    public String getVariantKey(HttpRequest req, HttpCacheEntry entry) {
+    public String getVariantKey(final HttpRequest req, final HttpCacheEntry entry) {
         List<String> variantHeaderNames = new ArrayList<String>();
         for (Header varyHdr : entry.getHeaders(HeaderConstants.VARY)) {
             for (HeaderElement elt : varyHdr.getElements()) {

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheMap.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheMap.java?rev=1433569&r1=1433568&r2=1433569&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheMap.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheMap.java Tue Jan 15 18:29:58 2013
@@ -37,7 +37,7 @@ final class CacheMap extends LinkedHashM
 
     private final int maxEntries;
 
-    CacheMap(int maxEntries) {
+    CacheMap(final int maxEntries) {
         super(20, 0.75f, true);
         this.maxEntries = maxEntries;
     }

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheValidityPolicy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheValidityPolicy.java?rev=1433569&r1=1433568&r2=1433569&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheValidityPolicy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheValidityPolicy.java Tue Jan 15 18:29:58 2013
@@ -50,7 +50,7 @@ class CacheValidityPolicy {
         super();
     }
 
-    public long getCurrentAgeSecs(final HttpCacheEntry entry, Date now) {
+    public long getCurrentAgeSecs(final HttpCacheEntry entry, final Date now) {
         return getCorrectedInitialAgeSecs(entry) + getResidentTimeSecs(entry, now);
     }
 
@@ -73,7 +73,7 @@ class CacheValidityPolicy {
         return (diff / 1000);
     }
 
-    public boolean isResponseFresh(final HttpCacheEntry entry, Date now) {
+    public boolean isResponseFresh(final HttpCacheEntry entry, final Date now) {
         return (getCurrentAgeSecs(entry, now) < getFreshnessLifetimeSecs(entry));
     }
 
@@ -91,12 +91,12 @@ class CacheValidityPolicy {
      * @return {@code true} if the response is fresh
      */
     public boolean isResponseHeuristicallyFresh(final HttpCacheEntry entry,
-            Date now, float coefficient, long defaultLifetime) {
+            final Date now, final float coefficient, final long defaultLifetime) {
         return (getCurrentAgeSecs(entry, now) < getHeuristicFreshnessLifetimeSecs(entry, coefficient, defaultLifetime));
     }
 
-    public long getHeuristicFreshnessLifetimeSecs(HttpCacheEntry entry,
-            float coefficient, long defaultLifetime) {
+    public long getHeuristicFreshnessLifetimeSecs(final HttpCacheEntry entry,
+            final float coefficient, final long defaultLifetime) {
         Date dateValue = getDateValue(entry);
         Date lastModifiedValue = getLastModifiedValue(entry);
 
@@ -124,7 +124,7 @@ class CacheValidityPolicy {
         return hasCacheControlDirective(entry, HeaderConstants.CACHE_CONTROL_PROXY_REVALIDATE);
     }
 
-    public boolean mayReturnStaleWhileRevalidating(final HttpCacheEntry entry, Date now) {
+    public boolean mayReturnStaleWhileRevalidating(final HttpCacheEntry entry, final Date now) {
         for (Header h : entry.getHeaders(HeaderConstants.CACHE_CONTROL)) {
             for(HeaderElement elt : h.getElements()) {
                 if (HeaderConstants.STALE_WHILE_REVALIDATE.equalsIgnoreCase(elt.getName())) {
@@ -143,8 +143,8 @@ class CacheValidityPolicy {
         return false;
     }
 
-    public boolean mayReturnStaleIfError(HttpRequest request,
-            HttpCacheEntry entry, Date now) {
+    public boolean mayReturnStaleIfError(final HttpRequest request,
+            final HttpCacheEntry entry, final Date now) {
         long stalenessSecs = getStalenessSecs(entry, now);
         return mayReturnStaleIfError(request.getHeaders(HeaderConstants.CACHE_CONTROL),
                                      stalenessSecs)
@@ -152,7 +152,7 @@ class CacheValidityPolicy {
                                          stalenessSecs);
     }
 
-    private boolean mayReturnStaleIfError(Header[] headers, long stalenessSecs) {
+    private boolean mayReturnStaleIfError(final Header[] headers, final long stalenessSecs) {
         boolean result = false;
         for(Header h : headers) {
             for(HeaderElement elt : h.getElements()) {
@@ -211,7 +211,7 @@ class CacheValidityPolicy {
         }
     }
 
-    protected boolean hasContentLengthHeader(HttpCacheEntry entry) {
+    protected boolean hasContentLengthHeader(final HttpCacheEntry entry) {
         return null != entry.getFirstHeader(HTTP.CONTENT_LEN);
     }
 
@@ -270,7 +270,7 @@ class CacheValidityPolicy {
         return getCorrectedReceivedAgeSecs(entry) + getResponseDelaySecs(entry);
     }
 
-    protected long getResidentTimeSecs(HttpCacheEntry entry, Date now) {
+    protected long getResidentTimeSecs(final HttpCacheEntry entry, final Date now) {
         long diff = now.getTime() - entry.getResponseDate().getTime();
         return (diff / 1000L);
     }
@@ -321,7 +321,7 @@ class CacheValidityPolicy {
         return false;
     }
 
-    public long getStalenessSecs(HttpCacheEntry entry, Date now) {
+    public long getStalenessSecs(final HttpCacheEntry entry, final Date now) {
         long age = getCurrentAgeSecs(entry, now);
         long freshness = getFreshnessLifetimeSecs(entry);
         if (age <= freshness) {

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheableRequestPolicy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheableRequestPolicy.java?rev=1433569&r1=1433568&r2=1433569&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheableRequestPolicy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheableRequestPolicy.java Tue Jan 15 18:29:58 2013
@@ -53,7 +53,7 @@ class CacheableRequestPolicy {
      *            an HttpRequest
      * @return boolean Is it possible to serve this request from cache
      */
-    public boolean isServableFromCache(HttpRequest request) {
+    public boolean isServableFromCache(final HttpRequest request) {
         String method = request.getRequestLine().getMethod();
 
         ProtocolVersion pv = request.getRequestLine().getProtocolVersion();

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedHttpResponseGenerator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedHttpResponseGenerator.java?rev=1433569&r1=1433568&r2=1433569&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedHttpResponseGenerator.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedHttpResponseGenerator.java Tue Jan 15 18:29:58 2013
@@ -69,7 +69,7 @@ class CachedHttpResponseGenerator {
      *            {@link CacheEntity} to transform into an {@link HttpResponse}
      * @return {@link HttpResponse} that was constructed
      */
-    HttpResponse generateResponse(HttpCacheEntry entry) {
+    HttpResponse generateResponse(final HttpCacheEntry entry) {
 
         Date now = new Date();
         HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, entry
@@ -102,7 +102,7 @@ class CachedHttpResponseGenerator {
      * @param entry
      * @return
      */
-    HttpResponse generateNotModifiedResponse(HttpCacheEntry entry) {
+    HttpResponse generateNotModifiedResponse(final HttpCacheEntry entry) {
 
         HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_NOT_MODIFIED, "Not Modified");
@@ -150,7 +150,7 @@ class CachedHttpResponseGenerator {
         return response;
     }
 
-    private void addMissingContentLengthHeader(HttpResponse response, HttpEntity entity) {
+    private void addMissingContentLengthHeader(final HttpResponse response, final HttpEntity entity) {
         if (transferEncodingIsPresent(response)) {
 			return;
 		}
@@ -163,7 +163,7 @@ class CachedHttpResponseGenerator {
         }
     }
 
-    private boolean transferEncodingIsPresent(HttpResponse response) {
+    private boolean transferEncodingIsPresent(final HttpResponse response) {
         Header hdr = response.getFirstHeader(HTTP.TRANSFER_ENCODING);
         return hdr != null;
     }

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedResponseSuitabilityChecker.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedResponseSuitabilityChecker.java?rev=1433569&r1=1433568&r2=1433569&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedResponseSuitabilityChecker.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedResponseSuitabilityChecker.java Tue Jan 15 18:29:58 2013
@@ -59,7 +59,7 @@ class CachedResponseSuitabilityChecker {
     private final CacheValidityPolicy validityStrategy;
 
     CachedResponseSuitabilityChecker(final CacheValidityPolicy validityStrategy,
-            CacheConfig config) {
+            final CacheConfig config) {
         super();
         this.validityStrategy = validityStrategy;
         this.sharedCache = config.isSharedCache();
@@ -68,11 +68,11 @@ class CachedResponseSuitabilityChecker {
         this.heuristicDefaultLifetime = config.getHeuristicDefaultLifetime();
     }
 
-    CachedResponseSuitabilityChecker(CacheConfig config) {
+    CachedResponseSuitabilityChecker(final CacheConfig config) {
         this(new CacheValidityPolicy(), config);
     }
 
-    private boolean isFreshEnough(HttpCacheEntry entry, HttpRequest request, Date now) {
+    private boolean isFreshEnough(final HttpCacheEntry entry, final HttpRequest request, final Date now) {
         if (validityStrategy.isResponseFresh(entry, now)) {
 			return true;
 		}
@@ -90,7 +90,7 @@ class CachedResponseSuitabilityChecker {
         return (maxstale > validityStrategy.getStalenessSecs(entry, now));
     }
 
-    private boolean originInsistsOnFreshness(HttpCacheEntry entry) {
+    private boolean originInsistsOnFreshness(final HttpCacheEntry entry) {
         if (validityStrategy.mustRevalidate(entry)) {
 			return true;
 		}
@@ -101,7 +101,7 @@ class CachedResponseSuitabilityChecker {
             validityStrategy.hasCacheControlDirective(entry, "s-maxage");
     }
 
-    private long getMaxStale(HttpRequest request) {
+    private long getMaxStale(final HttpRequest request) {
         long maxstale = -1;
         for(Header h : request.getHeaders(HeaderConstants.CACHE_CONTROL)) {
             for(HeaderElement elt : h.getElements()) {
@@ -143,7 +143,7 @@ class CachedResponseSuitabilityChecker {
      *            Right now in time
      * @return boolean yes/no answer
      */
-    public boolean canCachedResponseBeUsed(HttpHost host, HttpRequest request, HttpCacheEntry entry, Date now) {
+    public boolean canCachedResponseBeUsed(final HttpHost host, final HttpRequest request, final HttpCacheEntry entry, final Date now) {
 
         if (!isFreshEnough(entry, request, now)) {
             log.trace("Cache entry was not fresh enough");
@@ -239,7 +239,7 @@ class CachedResponseSuitabilityChecker {
      * @param request The current httpRequest being made
      * @return {@code true} if the request is supported
      */
-    public boolean isConditional(HttpRequest request) {
+    public boolean isConditional(final HttpRequest request) {
         return hasSupportedEtagValidator(request) || hasSupportedLastModifiedValidator(request);
     }
 
@@ -250,7 +250,7 @@ class CachedResponseSuitabilityChecker {
      * @param now right NOW in time
      * @return {@code true} if the request matches all conditionals
      */
-    public boolean allConditionalsMatch(HttpRequest request, HttpCacheEntry entry, Date now) {
+    public boolean allConditionalsMatch(final HttpRequest request, final HttpCacheEntry entry, final Date now) {
         boolean hasEtagValidator = hasSupportedEtagValidator(request);
         boolean hasLastModifiedValidator = hasSupportedLastModifiedValidator(request);
 
@@ -270,17 +270,17 @@ class CachedResponseSuitabilityChecker {
         return true;
     }
 
-    private boolean hasUnsupportedConditionalHeaders(HttpRequest request) {
+    private boolean hasUnsupportedConditionalHeaders(final HttpRequest request) {
         return (request.getFirstHeader(HeaderConstants.IF_RANGE) != null
                 || request.getFirstHeader(HeaderConstants.IF_MATCH) != null
                 || hasValidDateField(request, HeaderConstants.IF_UNMODIFIED_SINCE));
     }
 
-    private boolean hasSupportedEtagValidator(HttpRequest request) {
+    private boolean hasSupportedEtagValidator(final HttpRequest request) {
         return request.containsHeader(HeaderConstants.IF_NONE_MATCH);
     }
 
-    private boolean hasSupportedLastModifiedValidator(HttpRequest request) {
+    private boolean hasSupportedLastModifiedValidator(final HttpRequest request) {
         return hasValidDateField(request, HeaderConstants.IF_MODIFIED_SINCE);
     }
 
@@ -290,7 +290,7 @@ class CachedResponseSuitabilityChecker {
      * @param entry the cache entry
      * @return boolean does the etag validator match
      */
-    private boolean etagValidatorMatches(HttpRequest request, HttpCacheEntry entry) {
+    private boolean etagValidatorMatches(final HttpRequest request, final HttpCacheEntry entry) {
         Header etagHeader = entry.getFirstHeader(HeaderConstants.ETAG);
         String etag = (etagHeader != null) ? etagHeader.getValue() : null;
         Header[] ifNoneMatch = request.getHeaders(HeaderConstants.IF_NONE_MATCH);
@@ -316,7 +316,7 @@ class CachedResponseSuitabilityChecker {
      * @param now right NOW in time
      * @return  boolean Does the last modified header match
      */
-    private boolean lastModifiedValidatorMatches(HttpRequest request, HttpCacheEntry entry, Date now) {
+    private boolean lastModifiedValidatorMatches(final HttpRequest request, final HttpCacheEntry entry, final Date now) {
         Header lastModifiedHeader = entry.getFirstHeader(HeaderConstants.LAST_MODIFIED);
         Date lastModified = null;
         try {
@@ -344,7 +344,7 @@ class CachedResponseSuitabilityChecker {
         return true;
     }
 
-    private boolean hasValidDateField(HttpRequest request, String headerName) {
+    private boolean hasValidDateField(final HttpRequest request, final String headerName) {
         for(Header h : request.getHeaders(headerName)) {
             try {
                 DateUtils.parseDate(h.getValue());

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingExec.java?rev=1433569&r1=1433568&r2=1433569&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingExec.java Tue Jan 15 18:29:58 2013
@@ -116,9 +116,9 @@ public class CachingExec implements Clie
     private final Log log = LogFactory.getLog(getClass());
 
     public CachingExec(
-            ClientExecChain backend,
-            HttpCache cache,
-            CacheConfig config) {
+            final ClientExecChain backend,
+            final HttpCache cache,
+            final CacheConfig config) {
         super();
         Args.notNull(backend, "HTTP backend");
         Args.notNull(cache, "HttpCache");
@@ -139,29 +139,29 @@ public class CachingExec implements Clie
     }
 
     public CachingExec(
-            ClientExecChain backend,
-            ResourceFactory resourceFactory,
-            HttpCacheStorage storage,
-            CacheConfig config) {
+            final ClientExecChain backend,
+            final ResourceFactory resourceFactory,
+            final HttpCacheStorage storage,
+            final CacheConfig config) {
         this(backend, new BasicHttpCache(resourceFactory, storage, config), config);
     }
 
-    public CachingExec(ClientExecChain backend) {
+    public CachingExec(final ClientExecChain backend) {
         this(backend, new BasicHttpCache(), CacheConfig.DEFAULT);
     }
 
     CachingExec(
-            ClientExecChain backend,
-            HttpCache responseCache,
-            CacheValidityPolicy validityPolicy,
-            ResponseCachingPolicy responseCachingPolicy,
-            CachedHttpResponseGenerator responseGenerator,
-            CacheableRequestPolicy cacheableRequestPolicy,
-            CachedResponseSuitabilityChecker suitabilityChecker,
-            ConditionalRequestBuilder conditionalRequestBuilder,
-            ResponseProtocolCompliance responseCompliance,
-            RequestProtocolCompliance requestCompliance,
-            CacheConfig config) {
+            final ClientExecChain backend,
+            final HttpCache responseCache,
+            final CacheValidityPolicy validityPolicy,
+            final ResponseCachingPolicy responseCachingPolicy,
+            final CachedHttpResponseGenerator responseGenerator,
+            final CacheableRequestPolicy cacheableRequestPolicy,
+            final CachedResponseSuitabilityChecker suitabilityChecker,
+            final ConditionalRequestBuilder conditionalRequestBuilder,
+            final ResponseProtocolCompliance responseCompliance,
+            final RequestProtocolCompliance requestCompliance,
+            final CacheConfig config) {
         this.cacheConfig = config != null ? config : CacheConfig.DEFAULT;
         this.backend = backend;
         this.responseCache = responseCache;
@@ -177,7 +177,7 @@ public class CachingExec implements Clie
     }
 
     private AsynchronousValidator makeAsynchronousValidator(
-            CacheConfig config) {
+            final CacheConfig config) {
         if (config.getAsynchronousWorkersMax() > 0) {
             return new AsynchronousValidator(this, config);
         }
@@ -397,7 +397,7 @@ public class CachingExec implements Clie
         }
     }
 
-    private void recordCacheUpdate(HttpContext context) {
+    private void recordCacheUpdate(final HttpContext context) {
         cacheUpdates.getAndIncrement();
         setResponseStatus(context, CacheResponseStatus.VALIDATED);
     }
@@ -412,8 +412,8 @@ public class CachingExec implements Clie
         }
     }
 
-    private HttpResponse generateCachedResponse(HttpRequestWrapper request,
-            HttpContext context, HttpCacheEntry entry, Date now) {
+    private HttpResponse generateCachedResponse(final HttpRequestWrapper request,
+            final HttpContext context, final HttpCacheEntry entry, final Date now) {
         final HttpResponse cachedResponse;
         if (request.containsHeader(HeaderConstants.IF_NONE_MATCH)
                 || request.containsHeader(HeaderConstants.IF_MODIFIED_SINCE)) {
@@ -586,8 +586,8 @@ public class CachingExec implements Clie
         }
     }
 
-    private boolean revalidationResponseIsTooOld(HttpResponse backendResponse,
-            HttpCacheEntry cacheEntry) {
+    private boolean revalidationResponseIsTooOld(final HttpResponse backendResponse,
+            final HttpCacheEntry cacheEntry) {
         final Header entryDateHeader = cacheEntry.getFirstHeader(HTTP.DATE_HEADER);
         final Header responseDateHeader = backendResponse.getFirstHeader(HTTP.DATE_HEADER);
         if (entryDateHeader != null && responseDateHeader != null) {
@@ -785,7 +785,7 @@ public class CachingExec implements Clie
                 requestDate, responseDate, backendResponse);
     }
 
-    private boolean staleIfErrorAppliesTo(int statusCode) {
+    private boolean staleIfErrorAppliesTo(final int statusCode) {
         return statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR
                 || statusCode == HttpStatus.SC_BAD_GATEWAY
                 || statusCode == HttpStatus.SC_SERVICE_UNAVAILABLE
@@ -835,7 +835,7 @@ public class CachingExec implements Clie
      * included in the resulting response.
      */
     private void storeRequestIfModifiedSinceFor304Response(
-            HttpRequest request, HttpResponse backendResponse) {
+            final HttpRequest request, final HttpResponse backendResponse) {
         if (backendResponse.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_MODIFIED) {
             Header h = request.getFirstHeader("If-Modified-Since");
             if (h != null) {
@@ -844,8 +844,8 @@ public class CachingExec implements Clie
         }
     }
 
-    private boolean alreadyHaveNewerCacheEntry(HttpHost target, HttpRequestWrapper request,
-            HttpResponse backendResponse) {
+    private boolean alreadyHaveNewerCacheEntry(final HttpHost target, final HttpRequestWrapper request,
+            final HttpResponse backendResponse) {
         HttpCacheEntry existing = null;
         try {
             existing = responseCache.getCacheEntry(target, request);

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java?rev=1433569&r1=1433568&r2=1433569&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java Tue Jan 15 18:29:58 2013
@@ -162,9 +162,9 @@ public class CachingHttpClient implement
     private final Log log = LogFactory.getLog(getClass());
 
     CachingHttpClient(
-            HttpClient client,
-            HttpCache cache,
-            CacheConfig config) {
+            final HttpClient client,
+            final HttpCache cache,
+            final CacheConfig config) {
         super();
         Args.notNull(client, "HttpClient");
         Args.notNull(cache, "HttpCache");
@@ -204,7 +204,7 @@ public class CachingHttpClient implement
      * for backend requests.
      * @param config cache module options
      */
-    public CachingHttpClient(CacheConfig config) {
+    public CachingHttpClient(final CacheConfig config) {
         this(new DefaultHttpClient(),
                 new BasicHttpCache(config),
                 config);
@@ -216,7 +216,7 @@ public class CachingHttpClient implement
      * for backend requests.
      * @param client used to make origin requests
      */
-    public CachingHttpClient(HttpClient client) {
+    public CachingHttpClient(final HttpClient client) {
         this(client,
                 new BasicHttpCache(),
                 new CacheConfig());
@@ -229,7 +229,7 @@ public class CachingHttpClient implement
      * @param config cache module options
      * @param client used to make origin requests
      */
-    public CachingHttpClient(HttpClient client, CacheConfig config) {
+    public CachingHttpClient(final HttpClient client, final CacheConfig config) {
         this(client,
                 new BasicHttpCache(config),
                 config);
@@ -246,10 +246,10 @@ public class CachingHttpClient implement
      * @param config cache module options
      */
     public CachingHttpClient(
-            HttpClient client,
-            ResourceFactory resourceFactory,
-            HttpCacheStorage storage,
-            CacheConfig config) {
+            final HttpClient client,
+            final ResourceFactory resourceFactory,
+            final HttpCacheStorage storage,
+            final CacheConfig config) {
         this(client,
                 new BasicHttpCache(resourceFactory, storage, config),
                 config);
@@ -264,25 +264,25 @@ public class CachingHttpClient implement
      * @param config cache module options
      */
     public CachingHttpClient(
-            HttpClient client,
-            HttpCacheStorage storage,
-            CacheConfig config) {
+            final HttpClient client,
+            final HttpCacheStorage storage,
+            final CacheConfig config) {
         this(client,
                 new BasicHttpCache(new HeapResourceFactory(), storage, config),
                 config);
     }
 
     CachingHttpClient(
-            HttpClient backend,
-            CacheValidityPolicy validityPolicy,
-            ResponseCachingPolicy responseCachingPolicy,
-            HttpCache responseCache,
-            CachedHttpResponseGenerator responseGenerator,
-            CacheableRequestPolicy cacheableRequestPolicy,
-            CachedResponseSuitabilityChecker suitabilityChecker,
-            ConditionalRequestBuilder conditionalRequestBuilder,
-            ResponseProtocolCompliance responseCompliance,
-            RequestProtocolCompliance requestCompliance) {
+            final HttpClient backend,
+            final CacheValidityPolicy validityPolicy,
+            final ResponseCachingPolicy responseCachingPolicy,
+            final HttpCache responseCache,
+            final CachedHttpResponseGenerator responseGenerator,
+            final CacheableRequestPolicy cacheableRequestPolicy,
+            final CachedResponseSuitabilityChecker suitabilityChecker,
+            final ConditionalRequestBuilder conditionalRequestBuilder,
+            final ResponseProtocolCompliance responseCompliance,
+            final RequestProtocolCompliance requestCompliance) {
         CacheConfig config = new CacheConfig();
         this.maxObjectSizeBytes = config.getMaxObjectSize();
         this.sharedCache = config.isSharedCache();
@@ -300,7 +300,7 @@ public class CachingHttpClient implement
     }
 
     private AsynchronousValidator makeAsynchronousValidator(
-            CacheConfig config) {
+            final CacheConfig config) {
         if (config.getAsynchronousWorkersMax() > 0) {
             return new AsynchronousValidator(this, config);
         }
@@ -334,47 +334,47 @@ public class CachingHttpClient implement
         return cacheUpdates.get();
     }
 
-    public HttpResponse execute(HttpHost target, HttpRequest request) throws IOException {
+    public HttpResponse execute(final HttpHost target, final HttpRequest request) throws IOException {
         HttpContext defaultContext = null;
         return execute(target, request, defaultContext);
     }
 
-    public <T> T execute(HttpHost target, HttpRequest request,
-                         ResponseHandler<? extends T> responseHandler) throws IOException {
+    public <T> T execute(final HttpHost target, final HttpRequest request,
+                         final ResponseHandler<? extends T> responseHandler) throws IOException {
         return execute(target, request, responseHandler, null);
     }
 
-    public <T> T execute(HttpHost target, HttpRequest request,
-                         ResponseHandler<? extends T> responseHandler, HttpContext context) throws IOException {
+    public <T> T execute(final HttpHost target, final HttpRequest request,
+                         final ResponseHandler<? extends T> responseHandler, final HttpContext context) throws IOException {
         HttpResponse resp = execute(target, request, context);
         return handleAndConsume(responseHandler,resp);
     }
 
-    public HttpResponse execute(HttpUriRequest request) throws IOException {
+    public HttpResponse execute(final HttpUriRequest request) throws IOException {
         HttpContext context = null;
         return execute(request, context);
     }
 
-    public HttpResponse execute(HttpUriRequest request, HttpContext context) throws IOException {
+    public HttpResponse execute(final HttpUriRequest request, final HttpContext context) throws IOException {
         URI uri = request.getURI();
         HttpHost httpHost = new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme());
         return execute(httpHost, request, context);
     }
 
-    public <T> T execute(HttpUriRequest request, ResponseHandler<? extends T> responseHandler)
+    public <T> T execute(final HttpUriRequest request, final ResponseHandler<? extends T> responseHandler)
             throws IOException {
         return execute(request, responseHandler, null);
     }
 
-    public <T> T execute(HttpUriRequest request, ResponseHandler<? extends T> responseHandler,
-                         HttpContext context) throws IOException {
+    public <T> T execute(final HttpUriRequest request, final ResponseHandler<? extends T> responseHandler,
+                         final HttpContext context) throws IOException {
         HttpResponse resp = execute(request, context);
         return handleAndConsume(responseHandler, resp);
     }
 
     private <T> T handleAndConsume(
             final ResponseHandler<? extends T> responseHandler,
-            HttpResponse response) throws Error, IOException {
+            final HttpResponse response) throws Error, IOException {
         T result;
         try {
             result = responseHandler.handleResponse(response);
@@ -411,7 +411,7 @@ public class CachingHttpClient implement
         return backend.getParams();
     }
 
-    public HttpResponse execute(HttpHost target, HttpRequest originalRequest, HttpContext context)
+    public HttpResponse execute(final HttpHost target, final HttpRequest originalRequest, final HttpContext context)
             throws IOException {
 
         HttpRequestWrapper request;
@@ -455,8 +455,8 @@ public class CachingHttpClient implement
         return handleCacheHit(target, request, context, entry);
     }
 
-    private HttpResponse handleCacheHit(HttpHost target, HttpRequestWrapper request,
-            HttpContext context, HttpCacheEntry entry)
+    private HttpResponse handleCacheHit(final HttpHost target, final HttpRequestWrapper request,
+            final HttpContext context, final HttpCacheEntry entry)
             throws ClientProtocolException, IOException {
         recordCacheHit(target, request);
         HttpResponse out = null;
@@ -483,9 +483,9 @@ public class CachingHttpClient implement
         return out;
     }
 
-    private HttpResponse revalidateCacheEntry(HttpHost target,
-            HttpRequestWrapper request, HttpContext context, HttpCacheEntry entry,
-            Date now) throws ClientProtocolException {
+    private HttpResponse revalidateCacheEntry(final HttpHost target,
+            final HttpRequestWrapper request, final HttpContext context, final HttpCacheEntry entry,
+            final Date now) throws ClientProtocolException {
 
         try {
             if (asynchRevalidator != null
@@ -506,8 +506,8 @@ public class CachingHttpClient implement
         }
     }
 
-    private HttpResponse handleCacheMiss(HttpHost target, HttpRequestWrapper request,
-            HttpContext context) throws IOException {
+    private HttpResponse handleCacheMiss(final HttpHost target, final HttpRequestWrapper request,
+            final HttpContext context) throws IOException {
         recordCacheMiss(target, request);
 
         if (!mayCallBackend(request)) {
@@ -524,7 +524,7 @@ public class CachingHttpClient implement
         return callBackend(target, request, context);
     }
 
-    private HttpCacheEntry satisfyFromCache(HttpHost target, HttpRequestWrapper request) {
+    private HttpCacheEntry satisfyFromCache(final HttpHost target, final HttpRequestWrapper request) {
         HttpCacheEntry entry = null;
         try {
             entry = responseCache.getCacheEntry(target, request);
@@ -534,8 +534,8 @@ public class CachingHttpClient implement
         return entry;
     }
 
-    private HttpResponse getFatallyNoncompliantResponse(HttpRequestWrapper request,
-            HttpContext context) {
+    private HttpResponse getFatallyNoncompliantResponse(final HttpRequestWrapper request,
+            final HttpContext context) {
         HttpResponse fatalErrorResponse = null;
         List<RequestProtocolError> fatalError = requestCompliance.requestIsFatallyNonCompliant(request);
 
@@ -546,8 +546,8 @@ public class CachingHttpClient implement
         return fatalErrorResponse;
     }
 
-    private Map<String, Variant> getExistingCacheVariants(HttpHost target,
-            HttpRequestWrapper request) {
+    private Map<String, Variant> getExistingCacheVariants(final HttpHost target,
+            final HttpRequestWrapper request) {
         Map<String,Variant> variants = null;
         try {
             variants = responseCache.getVariantCacheEntriesWithEtags(target, request);
@@ -557,7 +557,7 @@ public class CachingHttpClient implement
         return variants;
     }
 
-    private void recordCacheMiss(HttpHost target, HttpRequestWrapper request) {
+    private void recordCacheMiss(final HttpHost target, final HttpRequestWrapper request) {
         cacheMisses.getAndIncrement();
         if (log.isTraceEnabled()) {
             RequestLine rl = request.getRequestLine();
@@ -565,7 +565,7 @@ public class CachingHttpClient implement
         }
     }
 
-    private void recordCacheHit(HttpHost target, HttpRequestWrapper request) {
+    private void recordCacheHit(final HttpHost target, final HttpRequestWrapper request) {
         cacheHits.getAndIncrement();
         if (log.isTraceEnabled()) {
             RequestLine rl = request.getRequestLine();
@@ -573,13 +573,13 @@ public class CachingHttpClient implement
         }
     }
 
-    private void recordCacheUpdate(HttpContext context) {
+    private void recordCacheUpdate(final HttpContext context) {
         cacheUpdates.getAndIncrement();
         setResponseStatus(context, CacheResponseStatus.VALIDATED);
     }
 
-    private void flushEntriesInvalidatedByRequest(HttpHost target,
-            HttpRequestWrapper request) {
+    private void flushEntriesInvalidatedByRequest(final HttpHost target,
+            final HttpRequestWrapper request) {
         try {
             responseCache.flushInvalidatedCacheEntriesFor(target, request);
         } catch (IOException ioe) {
@@ -587,8 +587,8 @@ public class CachingHttpClient implement
         }
     }
 
-    private HttpResponse generateCachedResponse(HttpRequestWrapper request,
-            HttpContext context, HttpCacheEntry entry, Date now) {
+    private HttpResponse generateCachedResponse(final HttpRequestWrapper request,
+            final HttpContext context, final HttpCacheEntry entry, final Date now) {
         final HttpResponse cachedResponse;
         if (request.containsHeader(HeaderConstants.IF_NONE_MATCH)
                 || request.containsHeader(HeaderConstants.IF_MODIFIED_SINCE)) {
@@ -603,8 +603,8 @@ public class CachingHttpClient implement
         return cachedResponse;
     }
 
-    private HttpResponse handleRevalidationFailure(HttpRequestWrapper request,
-            HttpContext context, HttpCacheEntry entry, Date now) {
+    private HttpResponse handleRevalidationFailure(final HttpRequestWrapper request,
+            final HttpContext context, final HttpCacheEntry entry, final Date now) {
         if (staleResponseNotAllowed(request, entry, now)) {
             return generateGatewayTimeout(context);
         } else {
@@ -612,28 +612,28 @@ public class CachingHttpClient implement
         }
     }
 
-    private HttpResponse generateGatewayTimeout(HttpContext context) {
+    private HttpResponse generateGatewayTimeout(final HttpContext context) {
         setResponseStatus(context, CacheResponseStatus.CACHE_MODULE_RESPONSE);
         return new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_GATEWAY_TIMEOUT, "Gateway Timeout");
     }
 
-    private HttpResponse unvalidatedCacheHit(HttpContext context,
-            HttpCacheEntry entry) {
+    private HttpResponse unvalidatedCacheHit(final HttpContext context,
+            final HttpCacheEntry entry) {
         final HttpResponse cachedResponse = responseGenerator.generateResponse(entry);
         setResponseStatus(context, CacheResponseStatus.CACHE_HIT);
         cachedResponse.addHeader(HeaderConstants.WARNING, "111 localhost \"Revalidation failed\"");
         return cachedResponse;
     }
 
-    private boolean staleResponseNotAllowed(HttpRequestWrapper request,
-            HttpCacheEntry entry, Date now) {
+    private boolean staleResponseNotAllowed(final HttpRequestWrapper request,
+            final HttpCacheEntry entry, final Date now) {
         return validityPolicy.mustRevalidate(entry)
             || (isSharedCache() && validityPolicy.proxyRevalidate(entry))
             || explicitFreshnessRequest(request, entry, now);
     }
 
-    private boolean mayCallBackend(HttpRequestWrapper request) {
+    private boolean mayCallBackend(final HttpRequestWrapper request) {
         for (Header h: request.getHeaders(HeaderConstants.CACHE_CONTROL)) {
             for (HeaderElement elt : h.getElements()) {
                 if ("only-if-cached".equals(elt.getName())) {
@@ -645,7 +645,7 @@ public class CachingHttpClient implement
         return true;
     }
 
-    private boolean explicitFreshnessRequest(HttpRequestWrapper request, HttpCacheEntry entry, Date now) {
+    private boolean explicitFreshnessRequest(final HttpRequestWrapper request, final HttpCacheEntry entry, final Date now) {
         for(Header h : request.getHeaders(HeaderConstants.CACHE_CONTROL)) {
             for(HeaderElement elt : h.getElements()) {
                 if (HeaderConstants.CACHE_CONTROL_MAX_STALE.equals(elt.getName())) {
@@ -668,7 +668,7 @@ public class CachingHttpClient implement
         return false;
     }
 
-    private String generateViaHeader(HttpMessage msg) {
+    private String generateViaHeader(final HttpMessage msg) {
 
         final ProtocolVersion pv = msg.getProtocolVersion();
         String existingEntry = viaHeaders.get(pv);
@@ -723,7 +723,7 @@ public class CachingHttpClient implement
         return new Date();
     }
 
-    boolean clientRequestsOurOptions(HttpRequest request) {
+    boolean clientRequestsOurOptions(final HttpRequest request) {
         RequestLine line = request.getRequestLine();
 
         if (!HeaderConstants.OPTIONS_METHOD.equals(line.getMethod())) {
@@ -741,7 +741,7 @@ public class CachingHttpClient implement
         return true;
     }
 
-    HttpResponse callBackend(HttpHost target, HttpRequestWrapper request, HttpContext context)
+    HttpResponse callBackend(final HttpHost target, final HttpRequestWrapper request, final HttpContext context)
             throws IOException {
 
         Date requestDate = getCurrentDate();
@@ -754,8 +754,8 @@ public class CachingHttpClient implement
 
     }
 
-    private boolean revalidationResponseIsTooOld(HttpResponse backendResponse,
-            HttpCacheEntry cacheEntry) {
+    private boolean revalidationResponseIsTooOld(final HttpResponse backendResponse,
+            final HttpCacheEntry cacheEntry) {
         final Header entryDateHeader = cacheEntry.getFirstHeader(HTTP.DATE_HEADER);
         final Header responseDateHeader = backendResponse.getFirstHeader(HTTP.DATE_HEADER);
         if (entryDateHeader != null && responseDateHeader != null) {
@@ -775,9 +775,9 @@ public class CachingHttpClient implement
         return false;
     }
 
-    HttpResponse negotiateResponseFromVariants(HttpHost target,
-            HttpRequestWrapper request, HttpContext context,
-            Map<String, Variant> variants) throws IOException {
+    HttpResponse negotiateResponseFromVariants(final HttpHost target,
+            final HttpRequestWrapper request, final HttpContext context,
+            final Map<String, Variant> variants) throws IOException {
         HttpRequestWrapper conditionalRequest = conditionalRequestBuilder
             .buildConditionalRequestFromVariants(request, variants);
 
@@ -828,18 +828,18 @@ public class CachingHttpClient implement
         return resp;
     }
 
-    private HttpResponse retryRequestUnconditionally(HttpHost target,
-            HttpRequestWrapper request, HttpContext context,
-            HttpCacheEntry matchedEntry) throws IOException {
+    private HttpResponse retryRequestUnconditionally(final HttpHost target,
+            final HttpRequestWrapper request, final HttpContext context,
+            final HttpCacheEntry matchedEntry) throws IOException {
         HttpRequestWrapper unconditional = conditionalRequestBuilder
             .buildUnconditionalRequest(request, matchedEntry);
         return callBackend(target, unconditional, context);
     }
 
-    private HttpCacheEntry getUpdatedVariantEntry(HttpHost target,
-            HttpRequestWrapper conditionalRequest, Date requestDate,
-            Date responseDate, HttpResponse backendResponse,
-            Variant matchingVariant, HttpCacheEntry matchedEntry) {
+    private HttpCacheEntry getUpdatedVariantEntry(final HttpHost target,
+            final HttpRequestWrapper conditionalRequest, final Date requestDate,
+            final Date responseDate, final HttpResponse backendResponse,
+            final Variant matchingVariant, final HttpCacheEntry matchedEntry) {
         HttpCacheEntry responseEntry = matchedEntry;
         try {
             responseEntry = responseCache.updateVariantCacheEntry(target, conditionalRequest,
@@ -850,8 +850,8 @@ public class CachingHttpClient implement
         return responseEntry;
     }
 
-    private void tryToUpdateVariantMap(HttpHost target, HttpRequestWrapper request,
-            Variant matchingVariant) {
+    private void tryToUpdateVariantMap(final HttpHost target, final HttpRequestWrapper request,
+            final Variant matchingVariant) {
         try {
             responseCache.reuseVariantEntryFor(target, request, matchingVariant);
         } catch (IOException ioe) {
@@ -859,17 +859,17 @@ public class CachingHttpClient implement
         }
     }
 
-    private boolean shouldSendNotModifiedResponse(HttpRequestWrapper request,
-            HttpCacheEntry responseEntry) {
+    private boolean shouldSendNotModifiedResponse(final HttpRequestWrapper request,
+            final HttpCacheEntry responseEntry) {
         return (suitabilityChecker.isConditional(request)
                 && suitabilityChecker.allConditionalsMatch(request, responseEntry, new Date()));
     }
 
     HttpResponse revalidateCacheEntry(
-            HttpHost target,
-            HttpRequestWrapper request,
-            HttpContext context,
-            HttpCacheEntry cacheEntry) throws IOException, ProtocolException {
+            final HttpHost target,
+            final HttpRequestWrapper request,
+            final HttpContext context,
+            final HttpCacheEntry cacheEntry) throws IOException, ProtocolException {
 
         HttpRequestWrapper conditionalRequest = conditionalRequestBuilder.buildConditionalRequest(request, cacheEntry);
 
@@ -919,7 +919,7 @@ public class CachingHttpClient implement
                                      backendResponse);
     }
 
-    private boolean staleIfErrorAppliesTo(int statusCode) {
+    private boolean staleIfErrorAppliesTo(final int statusCode) {
         return statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR
                 || statusCode == HttpStatus.SC_BAD_GATEWAY
                 || statusCode == HttpStatus.SC_SERVICE_UNAVAILABLE
@@ -927,11 +927,11 @@ public class CachingHttpClient implement
     }
 
     HttpResponse handleBackendResponse(
-            HttpHost target,
-            HttpRequestWrapper request,
-            Date requestDate,
-            Date responseDate,
-            HttpResponse backendResponse) throws IOException {
+            final HttpHost target,
+            final HttpRequestWrapper request,
+            final Date requestDate,
+            final Date responseDate,
+            final HttpResponse backendResponse) throws IOException {
 
         log.trace("Handling Backend response");
         responseCompliance.ensureProtocolCompliance(request, backendResponse);
@@ -967,7 +967,7 @@ public class CachingHttpClient implement
      * included in the resulting response.
      */
     private void storeRequestIfModifiedSinceFor304Response(
-            HttpRequest request, HttpResponse backendResponse) {
+            final HttpRequest request, final HttpResponse backendResponse) {
         if (backendResponse.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_MODIFIED) {
             Header h = request.getFirstHeader("If-Modified-Since");
             if (h != null) {
@@ -976,8 +976,8 @@ public class CachingHttpClient implement
         }
     }
 
-    private boolean alreadyHaveNewerCacheEntry(HttpHost target, HttpRequest request,
-            HttpResponse backendResponse) {
+    private boolean alreadyHaveNewerCacheEntry(final HttpHost target, final HttpRequest request,
+            final HttpResponse backendResponse) {
         HttpCacheEntry existing = null;
         try {
             existing = responseCache.getCacheEntry(target, request);
@@ -1025,8 +1025,8 @@ public class CachingHttpClient implement
          * {@link CacheConfig#getAsynchronousWorkerIdleLifetimeSecs()},
          * and {@link CacheConfig#getRevalidationQueueSize()}.
          */
-        public AsynchronousValidator(CachingHttpClient cachingClient,
-                CacheConfig config) {
+        public AsynchronousValidator(final CachingHttpClient cachingClient,
+                final CacheConfig config) {
             this(cachingClient,
                     new ThreadPoolExecutor(config.getAsynchronousWorkersCore(),
                             config.getAsynchronousWorkersMax(),
@@ -1043,8 +1043,8 @@ public class CachingHttpClient implement
          * @param cachingClient used to execute asynchronous requests
          * @param executor used to manage a thread pool of revalidation workers
          */
-        AsynchronousValidator(CachingHttpClient cachingClient,
-                ExecutorService executor) {
+        AsynchronousValidator(final CachingHttpClient cachingClient,
+                final ExecutorService executor) {
             this.cachingClient = cachingClient;
             this.executor = executor;
             this.queued = new HashSet<String>();
@@ -1059,8 +1059,8 @@ public class CachingHttpClient implement
          * @param context
          * @param entry
          */
-        public synchronized void revalidateCacheEntry(HttpHost target,
-                HttpRequestWrapper request, HttpContext context, HttpCacheEntry entry) {
+        public synchronized void revalidateCacheEntry(final HttpHost target,
+                final HttpRequestWrapper request, final HttpContext context, final HttpCacheEntry entry) {
             // getVariantURI will fall back on getURI if no variants exist
             String uri = cacheKeyGenerator.getVariantURI(target, request, entry);
 
@@ -1085,7 +1085,7 @@ public class CachingHttpClient implement
          * complete, using the identifier passed in during constructions.
          * @param identifier
          */
-        synchronized void markComplete(String identifier) {
+        synchronized void markComplete(final String identifier) {
             queued.remove(identifier);
         }
 
@@ -1120,11 +1120,11 @@ public class CachingHttpClient implement
          * @param bookKeeping
          * @param identifier
          */
-        AsynchronousValidationRequest(AsynchronousValidator parent,
-                CachingHttpClient cachingClient, HttpHost target,
-                HttpRequestWrapper request, HttpContext context,
-                HttpCacheEntry cacheEntry,
-                String identifier) {
+        AsynchronousValidationRequest(final AsynchronousValidator parent,
+                final CachingHttpClient cachingClient, final HttpHost target,
+                final HttpRequestWrapper request, final HttpContext context,
+                final HttpCacheEntry cacheEntry,
+                final String identifier) {
             this.parent = parent;
             this.cachingClient = cachingClient;
             this.target = target;

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ConditionalRequestBuilder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ConditionalRequestBuilder.java?rev=1433569&r1=1433568&r2=1433569&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ConditionalRequestBuilder.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ConditionalRequestBuilder.java Tue Jan 15 18:29:58 2013
@@ -53,7 +53,7 @@ class ConditionalRequestBuilder {
      * @return the wrapped request
      * @throws ProtocolException when I am unable to build a new origin request.
      */
-    public HttpRequestWrapper buildConditionalRequest(HttpRequestWrapper request, HttpCacheEntry cacheEntry)
+    public HttpRequestWrapper buildConditionalRequest(final HttpRequestWrapper request, final HttpCacheEntry cacheEntry)
             throws ProtocolException {
         HttpRequestWrapper newRequest = HttpRequestWrapper.wrap(request.getOriginal());
         newRequest.setHeaders(request.getAllHeaders());
@@ -92,8 +92,8 @@ class ConditionalRequestBuilder {
      * @param variants
      * @return the wrapped request
      */
-    public HttpRequestWrapper buildConditionalRequestFromVariants(HttpRequestWrapper request,
-            Map<String, Variant> variants) {
+    public HttpRequestWrapper buildConditionalRequestFromVariants(final HttpRequestWrapper request,
+            final Map<String, Variant> variants) {
         HttpRequestWrapper newRequest = HttpRequestWrapper.wrap(request.getOriginal());
         newRequest.setHeaders(request.getAllHeaders());
 
@@ -123,7 +123,7 @@ class ConditionalRequestBuilder {
      * @param entry existing cache entry we are trying to validate
      * @return an unconditional validation request
      */
-    public HttpRequestWrapper buildUnconditionalRequest(HttpRequestWrapper request, HttpCacheEntry entry) {
+    public HttpRequestWrapper buildUnconditionalRequest(final HttpRequestWrapper request, final HttpCacheEntry entry) {
         HttpRequestWrapper newRequest = HttpRequestWrapper.wrap(request.getOriginal());
         newRequest.setHeaders(request.getAllHeaders());
         newRequest.addHeader(HeaderConstants.CACHE_CONTROL,HeaderConstants.CACHE_CONTROL_NO_CACHE);

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultHttpCacheEntrySerializer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultHttpCacheEntrySerializer.java?rev=1433569&r1=1433568&r2=1433569&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultHttpCacheEntrySerializer.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultHttpCacheEntrySerializer.java Tue Jan 15 18:29:58 2013
@@ -48,7 +48,7 @@ import org.apache.http.client.cache.Http
 @Immutable
 public class DefaultHttpCacheEntrySerializer implements HttpCacheEntrySerializer {
 
-    public void writeTo(HttpCacheEntry cacheEntry, OutputStream os) throws IOException {
+    public void writeTo(final HttpCacheEntry cacheEntry, final OutputStream os) throws IOException {
         ObjectOutputStream oos = new ObjectOutputStream(os);
         try {
             oos.writeObject(cacheEntry);
@@ -57,7 +57,7 @@ public class DefaultHttpCacheEntrySerial
         }
     }
 
-    public HttpCacheEntry readFrom(InputStream is) throws IOException {
+    public HttpCacheEntry readFrom(final InputStream is) throws IOException {
         ObjectInputStream ois = new ObjectInputStream(is);
         try {
             return (HttpCacheEntry) ois.readObject();

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ManagedHttpCacheStorage.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ManagedHttpCacheStorage.java?rev=1433569&r1=1433568&r2=1433569&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ManagedHttpCacheStorage.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ManagedHttpCacheStorage.java Tue Jan 15 18:29:58 2013
@@ -103,7 +103,7 @@ public class ManagedHttpCacheStorage imp
         }
     }
 
-    public void removeEntry(String url) throws IOException {
+    public void removeEntry(final String url) throws IOException {
         Args.notNull(url, "URL");
         ensureValidState();
         synchronized (this) {

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/OptionsHttp11Response.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/OptionsHttp11Response.java?rev=1433569&r1=1433568&r2=1433569&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/OptionsHttp11Response.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/OptionsHttp11Response.java Tue Jan 15 18:29:58 2013
@@ -57,23 +57,23 @@ final class OptionsHttp11Response extend
         return statusLine;
     }
 
-    public void setStatusLine(StatusLine statusline) {
+    public void setStatusLine(final StatusLine statusline) {
         // No-op on purpose, this class is not going to be doing any work.
     }
 
-    public void setStatusLine(ProtocolVersion ver, int code) {
+    public void setStatusLine(final ProtocolVersion ver, final int code) {
         // No-op on purpose, this class is not going to be doing any work.
     }
 
-    public void setStatusLine(ProtocolVersion ver, int code, String reason) {
+    public void setStatusLine(final ProtocolVersion ver, final int code, final String reason) {
         // No-op on purpose, this class is not going to be doing any work.
     }
 
-    public void setStatusCode(int code) throws IllegalStateException {
+    public void setStatusCode(final int code) throws IllegalStateException {
         // No-op on purpose, this class is not going to be doing any work.
     }
 
-    public void setReasonPhrase(String reason) throws IllegalStateException {
+    public void setReasonPhrase(final String reason) throws IllegalStateException {
         // No-op on purpose, this class is not going to be doing any work.
     }
 
@@ -81,7 +81,7 @@ final class OptionsHttp11Response extend
         return null;
     }
 
-    public void setEntity(HttpEntity entity) {
+    public void setEntity(final HttpEntity entity) {
         // No-op on purpose, this class is not going to be doing any work.
     }
 
@@ -89,7 +89,7 @@ final class OptionsHttp11Response extend
         return null;
     }
 
-    public void setLocale(Locale loc) {
+    public void setLocale(final Locale loc) {
         // No-op on purpose, this class is not going to be doing any work.
     }
 
@@ -98,22 +98,22 @@ final class OptionsHttp11Response extend
     }
 
     @Override
-    public boolean containsHeader(String name) {
+    public boolean containsHeader(final String name) {
         return this.headergroup.containsHeader(name);
     }
 
     @Override
-    public Header[] getHeaders(String name) {
+    public Header[] getHeaders(final String name) {
         return this.headergroup.getHeaders(name);
     }
 
     @Override
-    public Header getFirstHeader(String name) {
+    public Header getFirstHeader(final String name) {
         return this.headergroup.getFirstHeader(name);
     }
 
     @Override
-    public Header getLastHeader(String name) {
+    public Header getLastHeader(final String name) {
         return this.headergroup.getLastHeader(name);
     }
 
@@ -123,37 +123,37 @@ final class OptionsHttp11Response extend
     }
 
     @Override
-    public void addHeader(Header header) {
+    public void addHeader(final Header header) {
         // No-op on purpose, this class is not going to be doing any work.
     }
 
     @Override
-    public void addHeader(String name, String value) {
+    public void addHeader(final String name, final String value) {
         // No-op on purpose, this class is not going to be doing any work.
     }
 
     @Override
-    public void setHeader(Header header) {
+    public void setHeader(final Header header) {
         // No-op on purpose, this class is not going to be doing any work.
     }
 
     @Override
-    public void setHeader(String name, String value) {
+    public void setHeader(final String name, final String value) {
         // No-op on purpose, this class is not going to be doing any work.
     }
 
     @Override
-    public void setHeaders(Header[] headers) {
+    public void setHeaders(final Header[] headers) {
         // No-op on purpose, this class is not going to be doing any work.
     }
 
     @Override
-    public void removeHeader(Header header) {
+    public void removeHeader(final Header header) {
         // No-op on purpose, this class is not going to be doing any work.
     }
 
     @Override
-    public void removeHeaders(String name) {
+    public void removeHeaders(final String name) {
         // No-op on purpose, this class is not going to be doing any work.
     }
 
@@ -163,7 +163,7 @@ final class OptionsHttp11Response extend
     }
 
     @Override
-    public HeaderIterator headerIterator(String name) {
+    public HeaderIterator headerIterator(final String name) {
         return this.headergroup.iterator(name);
     }
 
@@ -176,7 +176,7 @@ final class OptionsHttp11Response extend
     }
 
     @Override
-    public void setParams(HttpParams params) {
+    public void setParams(final HttpParams params) {
         // No-op on purpose, this class is not going to be doing any work.
     }
 }

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/RequestProtocolCompliance.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/RequestProtocolCompliance.java?rev=1433569&r1=1433568&r2=1433569&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/RequestProtocolCompliance.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/RequestProtocolCompliance.java Tue Jan 15 18:29:58 2013
@@ -65,7 +65,7 @@ class RequestProtocolCompliance {
      * @param request the HttpRequest Object
      * @return list of {@link RequestProtocolError}
      */
-    public List<RequestProtocolError> requestIsFatallyNonCompliant(HttpRequest request) {
+    public List<RequestProtocolError> requestIsFatallyNonCompliant(final HttpRequest request) {
         List<RequestProtocolError> theErrors = new ArrayList<RequestProtocolError>();
 
         RequestProtocolError anError = requestHasWeakETagAndRange(request);
@@ -94,7 +94,7 @@ class RequestProtocolCompliance {
      * @return the updated request
      * @throws ClientProtocolException when we have trouble making the request compliant
      */
-    public void makeRequestCompliant(HttpRequestWrapper request)
+    public void makeRequestCompliant(final HttpRequestWrapper request)
         throws ClientProtocolException {
 
         if (requestMustNotHaveEntity(request)) {
@@ -112,7 +112,7 @@ class RequestProtocolCompliance {
         }
     }
 
-    private void stripOtherFreshnessDirectivesWithNoCache(HttpRequest request) {
+    private void stripOtherFreshnessDirectivesWithNoCache(final HttpRequest request) {
         List<HeaderElement> outElts = new ArrayList<HeaderElement>();
         boolean shouldStrip = false;
         for(Header h : request.getHeaders(HeaderConstants.CACHE_CONTROL)) {
@@ -132,7 +132,7 @@ class RequestProtocolCompliance {
         request.setHeader(HeaderConstants.CACHE_CONTROL, buildHeaderFromElements(outElts));
     }
 
-    private String buildHeaderFromElements(List<HeaderElement> outElts) {
+    private String buildHeaderFromElements(final List<HeaderElement> outElts) {
         StringBuilder newHdr = new StringBuilder("");
         boolean first = true;
         for(HeaderElement elt : outElts) {
@@ -146,12 +146,12 @@ class RequestProtocolCompliance {
         return newHdr.toString();
     }
 
-    private boolean requestMustNotHaveEntity(HttpRequest request) {
+    private boolean requestMustNotHaveEntity(final HttpRequest request) {
         return HeaderConstants.TRACE_METHOD.equals(request.getRequestLine().getMethod())
                 && request instanceof HttpEntityEnclosingRequest;
     }
 
-    private void decrementOPTIONSMaxForwardsIfGreaterThen0(HttpRequest request) {
+    private void decrementOPTIONSMaxForwardsIfGreaterThen0(final HttpRequest request) {
         if (!HeaderConstants.OPTIONS_METHOD.equals(request.getRequestLine().getMethod())) {
             return;
         }
@@ -167,7 +167,7 @@ class RequestProtocolCompliance {
         request.setHeader(HeaderConstants.MAX_FORWARDS, Integer.toString(currentMaxForwards - 1));
     }
 
-    private void verifyOPTIONSRequestWithBodyHasContentType(HttpRequest request) {
+    private void verifyOPTIONSRequestWithBodyHasContentType(final HttpRequest request) {
         if (!HeaderConstants.OPTIONS_METHOD.equals(request.getRequestLine().getMethod())) {
             return;
         }
@@ -179,14 +179,14 @@ class RequestProtocolCompliance {
         addContentTypeHeaderIfMissing((HttpEntityEnclosingRequest) request);
     }
 
-    private void addContentTypeHeaderIfMissing(HttpEntityEnclosingRequest request) {
+    private void addContentTypeHeaderIfMissing(final HttpEntityEnclosingRequest request) {
         if (request.getEntity().getContentType() == null) {
             ((AbstractHttpEntity) request.getEntity()).setContentType(
                     ContentType.APPLICATION_OCTET_STREAM.getMimeType());
         }
     }
 
-    private void verifyRequestWithExpectContinueFlagHas100continueHeader(HttpRequest request) {
+    private void verifyRequestWithExpectContinueFlagHas100continueHeader(final HttpRequest request) {
         if (request instanceof HttpEntityEnclosingRequest) {
 
             if (((HttpEntityEnclosingRequest) request).expectContinue()
@@ -200,7 +200,7 @@ class RequestProtocolCompliance {
         }
     }
 
-    private void remove100ContinueHeaderIfExists(HttpRequest request) {
+    private void remove100ContinueHeaderIfExists(final HttpRequest request) {
         boolean hasHeader = false;
 
         Header[] expectHeaders = request.getHeaders(HTTP.EXPECT_DIRECTIVE);
@@ -228,7 +228,7 @@ class RequestProtocolCompliance {
         }
     }
 
-    private void add100ContinueHeaderIfMissing(HttpRequest request) {
+    private void add100ContinueHeaderIfMissing(final HttpRequest request) {
         boolean hasHeader = false;
 
         for (Header h : request.getHeaders(HTTP.EXPECT_DIRECTIVE)) {
@@ -244,7 +244,7 @@ class RequestProtocolCompliance {
         }
     }
 
-    protected boolean requestMinorVersionIsTooHighMajorVersionsMatch(HttpRequest request) {
+    protected boolean requestMinorVersionIsTooHighMajorVersionsMatch(final HttpRequest request) {
         ProtocolVersion requestProtocol = request.getProtocolVersion();
         if (requestProtocol.getMajor() != HttpVersion.HTTP_1_1.getMajor()) {
             return false;
@@ -257,7 +257,7 @@ class RequestProtocolCompliance {
         return false;
     }
 
-    protected boolean requestVersionIsTooLow(HttpRequest request) {
+    protected boolean requestVersionIsTooLow(final HttpRequest request) {
         return request.getProtocolVersion().compareToVersion(HttpVersion.HTTP_1_1) < 0;
     }
 
@@ -268,7 +268,7 @@ class RequestProtocolCompliance {
      * @param errorCheck What type of error should I get
      * @return The {@link HttpResponse} that is the error generated
      */
-    public HttpResponse getErrorForRequest(RequestProtocolError errorCheck) {
+    public HttpResponse getErrorForRequest(final RequestProtocolError errorCheck) {
         switch (errorCheck) {
             case BODY_BUT_NO_LENGTH_ERROR:
                 return new BasicHttpResponse(new BasicStatusLine(HttpVersion.HTTP_1_1,
@@ -295,7 +295,7 @@ class RequestProtocolCompliance {
         }
     }
 
-    private RequestProtocolError requestHasWeakETagAndRange(HttpRequest request) {
+    private RequestProtocolError requestHasWeakETagAndRange(final HttpRequest request) {
         // TODO: Should these be looking at all the headers marked as Range?
         String method = request.getRequestLine().getMethod();
         if (!(HeaderConstants.GET_METHOD.equals(method))) {
@@ -320,7 +320,7 @@ class RequestProtocolCompliance {
         return null;
     }
 
-    private RequestProtocolError requestHasWeekETagForPUTOrDELETEIfMatch(HttpRequest request) {
+    private RequestProtocolError requestHasWeekETagForPUTOrDELETEIfMatch(final HttpRequest request) {
         // TODO: Should these be looking at all the headers marked as If-Match/If-None-Match?
 
         String method = request.getRequestLine().getMethod();
@@ -350,7 +350,7 @@ class RequestProtocolCompliance {
         return null;
     }
 
-    private RequestProtocolError requestContainsNoCacheDirectiveWithFieldName(HttpRequest request) {
+    private RequestProtocolError requestContainsNoCacheDirectiveWithFieldName(final HttpRequest request) {
         for(Header h : request.getHeaders(HeaderConstants.CACHE_CONTROL)) {
             for(HeaderElement elt : h.getElements()) {
                 if (HeaderConstants.CACHE_CONTROL_NO_CACHE.equalsIgnoreCase(elt.getName())

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseCachingPolicy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseCachingPolicy.java?rev=1433569&r1=1433568&r2=1433569&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseCachingPolicy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseCachingPolicy.java Tue Jan 15 18:29:58 2013
@@ -77,8 +77,8 @@ class ResponseCachingPolicy {
      * @param neverCache1_0ResponsesWithQueryString true to never cache HTTP 1.0 responses with a query string, false
      * to cache if explicit cache headers are found.
      */
-    public ResponseCachingPolicy(long maxObjectSizeBytes, boolean sharedCache,
-                                 boolean neverCache1_0ResponsesWithQueryString
+    public ResponseCachingPolicy(final long maxObjectSizeBytes, final boolean sharedCache,
+                                 final boolean neverCache1_0ResponsesWithQueryString
     ) {
         this.maxObjectSizeBytes = maxObjectSizeBytes;
         this.sharedCache = sharedCache;
@@ -92,7 +92,7 @@ class ResponseCachingPolicy {
      * @param response The origin response
      * @return <code>true</code> if response is cacheable
      */
-    public boolean isResponseCacheable(String httpMethod, HttpResponse response) {
+    public boolean isResponseCacheable(final String httpMethod, final HttpResponse response) {
         boolean cacheable = false;
 
         if (!HeaderConstants.GET_METHOD.equals(httpMethod)) {
@@ -159,7 +159,7 @@ class ResponseCachingPolicy {
         return (cacheable || isExplicitlyCacheable(response));
     }
 
-    private boolean unknownStatusCode(int status) {
+    private boolean unknownStatusCode(final int status) {
         if (status >= 100 && status <= 101) {
 			return false;
 		}
@@ -178,7 +178,7 @@ class ResponseCachingPolicy {
         return true;
     }
 
-    protected boolean isExplicitlyNonCacheable(HttpResponse response) {
+    protected boolean isExplicitlyNonCacheable(final HttpResponse response) {
         Header[] cacheControlHeaders = response.getHeaders(HeaderConstants.CACHE_CONTROL);
         for (Header header : cacheControlHeaders) {
             for (HeaderElement elem : header.getElements()) {
@@ -192,7 +192,7 @@ class ResponseCachingPolicy {
         return false;
     }
 
-    protected boolean hasCacheControlParameterFrom(HttpMessage msg, String[] params) {
+    protected boolean hasCacheControlParameterFrom(final HttpMessage msg, final String[] params) {
         Header[] cacheControlHeaders = msg.getHeaders(HeaderConstants.CACHE_CONTROL);
         for (Header header : cacheControlHeaders) {
             for (HeaderElement elem : header.getElements()) {
@@ -206,7 +206,7 @@ class ResponseCachingPolicy {
         return false;
     }
 
-    protected boolean isExplicitlyCacheable(HttpResponse response) {
+    protected boolean isExplicitlyCacheable(final HttpResponse response) {
         if (response.getFirstHeader(HeaderConstants.EXPIRES) != null) {
 			return true;
 		}
@@ -226,7 +226,7 @@ class ResponseCachingPolicy {
      * @param response the {@link HttpResponse} from the origin
      * @return <code>true</code> if response is cacheable
      */
-    public boolean isResponseCacheable(HttpRequest request, HttpResponse response) {
+    public boolean isResponseCacheable(final HttpRequest request, final HttpResponse response) {
         if (requestProtocolGreaterThanAccepted(request)) {
             log.debug("Response was not cacheable.");
             return false;
@@ -266,7 +266,7 @@ class ResponseCachingPolicy {
     }
 
     private boolean expiresHeaderLessOrEqualToDateHeaderAndNoCacheControl(
-            HttpResponse response) {
+            final HttpResponse response) {
         if (response.getFirstHeader(HeaderConstants.CACHE_CONTROL) != null) {
 			return false;
 		}
@@ -284,7 +284,7 @@ class ResponseCachingPolicy {
         }
     }
 
-    private boolean from1_0Origin(HttpResponse response) {
+    private boolean from1_0Origin(final HttpResponse response) {
         Header via = response.getFirstHeader(HeaderConstants.VIA);
         if (via != null) {
             for(HeaderElement elt : via.getElements()) {
@@ -299,7 +299,7 @@ class ResponseCachingPolicy {
         return HttpVersion.HTTP_1_0.equals(response.getProtocolVersion());
     }
 
-    private boolean requestProtocolGreaterThanAccepted(HttpRequest req) {
+    private boolean requestProtocolGreaterThanAccepted(final HttpRequest req) {
         return req.getProtocolVersion().compareToVersion(HttpVersion.HTTP_1_1) > 0;
     }
 



Mime
View raw message