From a24b592e87b17d470a0db9dd36fc9126c8892da7 Mon Sep 17 00:00:00 2001 From: "Gary D. Gregory" Date: Tue, 23 Aug 2016 22:27:27 +0000 Subject: [PATCH] Use final. git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1757448 13f79535-47bb-0310-9956-ffa450edef68 --- .../hc/client5/http/impl/cache/CacheKeyGenerator.java | 2 +- .../apache/hc/client5/http/impl/cache/CachingExec.java | 2 +- .../hc/client5/http/impl/cache/HeapResourceFactory.java | 2 +- .../impl/cache/memcached/MemcachedCacheEntryImpl.java | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheKeyGenerator.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheKeyGenerator.java index 8a20212d6..f09805b1b 100644 --- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheKeyGenerator.java +++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheKeyGenerator.java @@ -154,7 +154,7 @@ class CacheKeyGenerator { } Collections.sort(variantHeaderNames); - StringBuilder buf; + final StringBuilder buf; try { buf = new StringBuilder("{"); boolean first = true; diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java index b39e39aaa..38a17cb22 100644 --- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java +++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java @@ -526,7 +526,7 @@ public class CachingExec implements ClientExecChain { final VersionInfo vi = VersionInfo.loadVersionInfo("org.apache.hc.client5", getClass().getClassLoader()); final String release = (vi != null) ? vi.getRelease() : VersionInfo.UNAVAILABLE; - String value; + final String value; final int major = pv.getMajor(); final int minor = pv.getMinor(); if ("http".equalsIgnoreCase(pv.getProtocol())) { diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/HeapResourceFactory.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/HeapResourceFactory.java index 67a0f1ed3..946db58dc 100644 --- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/HeapResourceFactory.java +++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/HeapResourceFactory.java @@ -67,7 +67,7 @@ public class HeapResourceFactory implements ResourceFactory { public Resource copy( final String requestId, final Resource resource) throws IOException { - byte[] body; + final byte[] body; if (resource instanceof HeapResource) { body = ((HeapResource) resource).getByteArray(); } else { diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/memcached/MemcachedCacheEntryImpl.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/memcached/MemcachedCacheEntryImpl.java index 17a2babb6..c16e3652b 100644 --- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/memcached/MemcachedCacheEntryImpl.java +++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/memcached/MemcachedCacheEntryImpl.java @@ -58,7 +58,7 @@ public class MemcachedCacheEntryImpl implements MemcachedCacheEntry { @Override synchronized public byte[] toByteArray() { final ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream oos; + final ObjectOutputStream oos; try { oos = new ObjectOutputStream(bos); oos.writeObject(this.key); @@ -92,9 +92,9 @@ public class MemcachedCacheEntryImpl implements MemcachedCacheEntry { @Override synchronized public void set(final byte[] bytes) { final ByteArrayInputStream bis = new ByteArrayInputStream(bytes); - ObjectInputStream ois; - String s; - HttpCacheEntry entry; + final ObjectInputStream ois; + final String s; + final HttpCacheEntry entry; try { ois = new ObjectInputStream(bis); s = (String)ois.readObject();