hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1571371 - in /httpcomponents/httpclient/trunk: httpclient-cache/src/test/java/org/apache/http/impl/client/cache/ httpclient-cache/src/test/java/org/apache/http/impl/client/cache/memcached/ httpclient/src/main/java/org/apache/http/client/me...
Date Mon, 24 Feb 2014 18:03:43 GMT
Author: sebb
Date: Mon Feb 24 18:03:43 2014
New Revision: 1571371

URL: http://svn.apache.org/r1571371
Log:
Rename or inline local variables to avoid variable hiding

Modified:
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheInvalidator.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheKeyGenerator.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachedHttpResponseGenerator.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExecChain.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestConditionalRequestBuilder.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestRFC5861Compliance.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestRequestProtocolCompliance.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/memcached/TestMemcachedCacheEntryImpl.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/methods/RequestBuilder.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/RequestWrapper.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestPoolingHttpClientConnectionManager.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestRetryExec.java

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheInvalidator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheInvalidator.java?rev=1571371&r1=1571370&r2=1571371&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheInvalidator.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheInvalidator.java
Mon Feb 24 18:03:43 2014
@@ -116,12 +116,12 @@ public class TestCacheInvalidator {
 
     @Test
     public void testInvalidatesUrisInContentLocationHeadersOnPUTs() throws Exception {
-        final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("PUT","/",HTTP_1_1);
-        request.setEntity(HttpTestUtils.makeBody(128));
-        request.setHeader("Content-Length","128");
+        final HttpEntityEnclosingRequest putRequest = new BasicHttpEntityEnclosingRequest("PUT","/",HTTP_1_1);
+        putRequest.setEntity(HttpTestUtils.makeBody(128));
+        putRequest.setHeader("Content-Length","128");
 
         final String contentLocation = "http://foo.example.com/content";
-        request.setHeader("Content-Location", contentLocation);
+        putRequest.setHeader("Content-Location", contentLocation);
 
         final String theUri = "http://foo.example.com:80/";
         cacheEntryHasVariantMap(new HashMap<String,String>());
@@ -132,19 +132,19 @@ public class TestCacheInvalidator {
 
         replayMocks();
 
-        impl.flushInvalidatedCacheEntries(host, request);
+        impl.flushInvalidatedCacheEntries(host, putRequest);
 
         verifyMocks();
     }
 
     @Test
     public void testInvalidatesUrisInLocationHeadersOnPUTs() throws Exception {
-        final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("PUT","/",HTTP_1_1);
-        request.setEntity(HttpTestUtils.makeBody(128));
-        request.setHeader("Content-Length","128");
+        final HttpEntityEnclosingRequest putRequest = new BasicHttpEntityEnclosingRequest("PUT","/",HTTP_1_1);
+        putRequest.setEntity(HttpTestUtils.makeBody(128));
+        putRequest.setHeader("Content-Length","128");
 
         final String contentLocation = "http://foo.example.com/content";
-        request.setHeader("Location",contentLocation);
+        putRequest.setHeader("Location",contentLocation);
 
         final String theUri = "http://foo.example.com:80/";
         cacheEntryHasVariantMap(new HashMap<String,String>());
@@ -155,19 +155,19 @@ public class TestCacheInvalidator {
 
         replayMocks();
 
-        impl.flushInvalidatedCacheEntries(host, request);
+        impl.flushInvalidatedCacheEntries(host, putRequest);
 
         verifyMocks();
     }
 
     @Test
     public void testInvalidatesRelativeUrisInContentLocationHeadersOnPUTs() throws Exception
{
-        final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("PUT","/",HTTP_1_1);
-        request.setEntity(HttpTestUtils.makeBody(128));
-        request.setHeader("Content-Length","128");
+        final HttpEntityEnclosingRequest putRequest = new BasicHttpEntityEnclosingRequest("PUT","/",HTTP_1_1);
+        putRequest.setEntity(HttpTestUtils.makeBody(128));
+        putRequest.setHeader("Content-Length","128");
 
         final String relativePath = "/content";
-        request.setHeader("Content-Location",relativePath);
+        putRequest.setHeader("Content-Location",relativePath);
 
         final String theUri = "http://foo.example.com:80/";
         cacheEntryHasVariantMap(new HashMap<String,String>());
@@ -178,19 +178,19 @@ public class TestCacheInvalidator {
 
         replayMocks();
 
-        impl.flushInvalidatedCacheEntries(host, request);
+        impl.flushInvalidatedCacheEntries(host, putRequest);
 
         verifyMocks();
     }
 
     @Test
     public void testDoesNotInvalidateUrisInContentLocationHeadersOnPUTsToDifferentHosts()
throws Exception {
-        final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("PUT","/",HTTP_1_1);
-        request.setEntity(HttpTestUtils.makeBody(128));
-        request.setHeader("Content-Length","128");
+        final HttpEntityEnclosingRequest putRequest = new BasicHttpEntityEnclosingRequest("PUT","/",HTTP_1_1);
+        putRequest.setEntity(HttpTestUtils.makeBody(128));
+        putRequest.setHeader("Content-Length","128");
 
         final String contentLocation = "http://bar.example.com/content";
-        request.setHeader("Content-Location",contentLocation);
+        putRequest.setHeader("Content-Location",contentLocation);
 
         final String theUri = "http://foo.example.com:80/";
         cacheEntryHasVariantMap(new HashMap<String,String>());
@@ -200,7 +200,7 @@ public class TestCacheInvalidator {
 
         replayMocks();
 
-        impl.flushInvalidatedCacheEntries(host, request);
+        impl.flushInvalidatedCacheEntries(host, putRequest);
 
         verifyMocks();
     }

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheKeyGenerator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheKeyGenerator.java?rev=1571371&r1=1571370&r2=1571371&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheKeyGenerator.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCacheKeyGenerator.java
Mon Feb 24 18:03:43 2014
@@ -39,6 +39,7 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
+@SuppressWarnings("boxing") // this is test code
 public class TestCacheKeyGenerator {
 
     private static final BasicHttpRequest REQUEST_FULL_EPISODES = new BasicHttpRequest("GET",
@@ -46,13 +47,13 @@ public class TestCacheKeyGenerator {
     private static final BasicHttpRequest REQUEST_ROOT = new BasicHttpRequest("GET", "/");
 
     CacheKeyGenerator extractor;
-    private HttpHost host;
+    private HttpHost defaultHost;
     private HttpCacheEntry mockEntry;
     private HttpRequest mockRequest;
 
     @Before
     public void setUp() throws Exception {
-        host = new HttpHost("foo.example.com");
+        defaultHost = new HttpHost("foo.example.com");
         mockEntry = EasyMock.createNiceMock(HttpCacheEntry.class);
         mockRequest = EasyMock.createNiceMock(HttpRequest.class);
         extractor = new CacheKeyGenerator();
@@ -127,14 +128,14 @@ public class TestCacheKeyGenerator {
         extractor = new CacheKeyGenerator() {
             @Override
             public String getURI(final HttpHost h, final HttpRequest req) {
-                Assert.assertSame(host, h);
+                Assert.assertSame(defaultHost, h);
                 Assert.assertSame(mockRequest, req);
                 return theURI;
             }
         };
 
         replayMocks();
-        final String result = extractor.getVariantURI(host, mockRequest, mockEntry);
+        final String result = extractor.getVariantURI(defaultHost, mockRequest, mockEntry);
         verifyMocks();
         Assert.assertSame(theURI, result);
     }
@@ -148,7 +149,7 @@ public class TestCacheKeyGenerator {
         extractor = new CacheKeyGenerator() {
             @Override
             public String getURI(final HttpHost h, final HttpRequest req) {
-                Assert.assertSame(host, h);
+                Assert.assertSame(defaultHost, h);
                 Assert.assertSame(mockRequest, req);
                 return theURI;
             }
@@ -159,7 +160,7 @@ public class TestCacheKeyGenerator {
                 encHeaders);
         replayMocks();
 
-        final String result = extractor.getVariantURI(host, mockRequest, mockEntry);
+        final String result = extractor.getVariantURI(defaultHost, mockRequest, mockEntry);
 
         verifyMocks();
         Assert.assertEquals("{Accept-Encoding=gzip}" + theURI, result);
@@ -173,7 +174,7 @@ public class TestCacheKeyGenerator {
         extractor = new CacheKeyGenerator() {
             @Override
             public String getURI(final HttpHost h, final HttpRequest req) {
-                Assert.assertSame(host, h);
+                Assert.assertSame(defaultHost, h);
                 Assert.assertSame(mockRequest, req);
                 return theURI;
             }
@@ -184,7 +185,7 @@ public class TestCacheKeyGenerator {
                 .andReturn(noHeaders);
         replayMocks();
 
-        final String result = extractor.getVariantURI(host, mockRequest, mockEntry);
+        final String result = extractor.getVariantURI(defaultHost, mockRequest, mockEntry);
 
         verifyMocks();
         Assert.assertEquals("{Accept-Encoding=}" + theURI, result);
@@ -199,7 +200,7 @@ public class TestCacheKeyGenerator {
         extractor = new CacheKeyGenerator() {
             @Override
             public String getURI(final HttpHost h, final HttpRequest req) {
-                Assert.assertSame(host, h);
+                Assert.assertSame(defaultHost, h);
                 Assert.assertSame(mockRequest, req);
                 return theURI;
             }
@@ -211,7 +212,7 @@ public class TestCacheKeyGenerator {
         EasyMock.expect(mockRequest.getHeaders("User-Agent")).andReturn(uaHeaders);
         replayMocks();
 
-        final String result = extractor.getVariantURI(host, mockRequest, mockEntry);
+        final String result = extractor.getVariantURI(defaultHost, mockRequest, mockEntry);
 
         verifyMocks();
         Assert.assertEquals("{Accept-Encoding=gzip&User-Agent=browser}" + theURI, result);
@@ -227,7 +228,7 @@ public class TestCacheKeyGenerator {
         extractor = new CacheKeyGenerator() {
             @Override
             public String getURI(final HttpHost h, final HttpRequest req) {
-                Assert.assertSame(host, h);
+                Assert.assertSame(defaultHost, h);
                 Assert.assertSame(mockRequest, req);
                 return theURI;
             }
@@ -238,7 +239,7 @@ public class TestCacheKeyGenerator {
         EasyMock.expect(mockRequest.getHeaders("User-Agent")).andReturn(uaHeaders);
         replayMocks();
 
-        final String result = extractor.getVariantURI(host, mockRequest, mockEntry);
+        final String result = extractor.getVariantURI(defaultHost, mockRequest, mockEntry);
 
         verifyMocks();
         Assert.assertEquals("{Accept-Encoding=gzip&User-Agent=browser}" + theURI, result);
@@ -254,7 +255,7 @@ public class TestCacheKeyGenerator {
         extractor = new CacheKeyGenerator() {
             @Override
             public String getURI(final HttpHost h, final HttpRequest req) {
-                Assert.assertSame(host, h);
+                Assert.assertSame(defaultHost, h);
                 Assert.assertSame(mockRequest, req);
                 return theURI;
             }
@@ -265,7 +266,7 @@ public class TestCacheKeyGenerator {
         EasyMock.expect(mockRequest.getHeaders("User-Agent")).andReturn(uaHeaders);
         replayMocks();
 
-        final String result = extractor.getVariantURI(host, mockRequest, mockEntry);
+        final String result = extractor.getVariantURI(defaultHost, mockRequest, mockEntry);
 
         verifyMocks();
         Assert

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachedHttpResponseGenerator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachedHttpResponseGenerator.java?rev=1571371&r1=1571370&r2=1571371&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachedHttpResponseGenerator.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachedHttpResponseGenerator.java
Mon Feb 24 18:03:43 2014
@@ -68,9 +68,9 @@ public class TestCachedHttpResponseGener
     @Test
     public void testResponseHasContentLength() {
         final byte[] buf = new byte[] { 1, 2, 3, 4, 5 };
-        final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(buf);
+        final HttpCacheEntry entry1 = HttpTestUtils.makeCacheEntry(buf);
 
-        final HttpResponse response = impl.generateResponse(entry);
+        final HttpResponse response = impl.generateResponse(entry1);
 
         final Header length = response.getFirstHeader("Content-Length");
         Assert.assertNotNull("Content-Length Header is missing", length);
@@ -84,9 +84,9 @@ public class TestCachedHttpResponseGener
 
         final Header[] hdrs = new Header[] { new BasicHeader("Transfer-Encoding", "chunked")
};
         final byte[] buf = new byte[] { 1, 2, 3, 4, 5 };
-        final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(hdrs, buf);
+        final HttpCacheEntry entry1 = HttpTestUtils.makeCacheEntry(hdrs, buf);
 
-        final HttpResponse response = impl.generateResponse(entry);
+        final HttpResponse response = impl.generateResponse(entry1);
 
         final Header length = response.getFirstHeader("Content-Length");
 

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExecChain.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExecChain.java?rev=1571371&r1=1571370&r2=1571371&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExecChain.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExecChain.java
Mon Feb 24 18:03:43 2014
@@ -327,9 +327,9 @@ public abstract class TestCachingExecCha
 
     @Test
     public void testNonCacheableResponseIsNotCachedAndIsReturnedAsIs() throws Exception {
-        final CacheConfig config = CacheConfig.DEFAULT;
+        final CacheConfig configDefault = CacheConfig.DEFAULT;
         impl = createCachingExecChain(mockBackend, new BasicHttpCache(new HeapResourceFactory(),
-            mockStorage, config), config);
+            mockStorage, configDefault), configDefault);
 
         final HttpRequestWrapper req1 = HttpRequestWrapper.wrap(HttpTestUtils.makeDefaultRequest());
         final HttpResponse resp1 = HttpTestUtils.make200Response();

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestConditionalRequestBuilder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestConditionalRequestBuilder.java?rev=1571371&r1=1571370&r2=1571371&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestConditionalRequestBuilder.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestConditionalRequestBuilder.java
Mon Feb 24 18:03:43 2014
@@ -65,9 +65,9 @@ public class TestConditionalRequestBuild
         final String theUri = "/theuri";
         final String lastModified = "this is my last modified date";
 
-        final HttpRequest request = new BasicHttpRequest(theMethod, theUri);
-        request.addHeader("Accept-Encoding", "gzip");
-        final HttpRequestWrapper requestWrapper = HttpRequestWrapper.wrap(request);
+        final HttpRequest basicRequest = new BasicHttpRequest(theMethod, theUri);
+        basicRequest.addHeader("Accept-Encoding", "gzip");
+        final HttpRequestWrapper requestWrapper = HttpRequestWrapper.wrap(basicRequest);
 
         final Header[] headers = new Header[] {
                 new BasicHeader("Date", DateUtils.formatDate(new Date())),
@@ -76,11 +76,11 @@ public class TestConditionalRequestBuild
         final HttpCacheEntry cacheEntry = HttpTestUtils.makeCacheEntry(headers);
         final HttpRequestWrapper newRequest = impl.buildConditionalRequest(requestWrapper,
cacheEntry);
 
-        Assert.assertNotSame(request, newRequest);
+        Assert.assertNotSame(basicRequest, newRequest);
 
         Assert.assertEquals(theMethod, newRequest.getRequestLine().getMethod());
         Assert.assertEquals(theUri, newRequest.getRequestLine().getUri());
-        Assert.assertEquals(request.getRequestLine().getProtocolVersion(), newRequest
+        Assert.assertEquals(basicRequest.getRequestLine().getProtocolVersion(), newRequest
                 .getRequestLine().getProtocolVersion());
         Assert.assertEquals(2, newRequest.getAllHeaders().length);
 
@@ -104,10 +104,10 @@ public class TestConditionalRequestBuild
             new BasicHeader("Last-Modified", lmDate),
             new BasicHeader("ETag", etag)
         };
-        final HttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
-        final HttpRequestWrapper requestWrapper = HttpRequestWrapper.wrap(request);
-        final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(headers);
-        final HttpRequest result = impl.buildConditionalRequest(requestWrapper, entry);
+        final HttpRequest basicRequest = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
+        final HttpRequestWrapper requestWrapper = HttpRequestWrapper.wrap(basicRequest);
+        final HttpCacheEntry cacheEntry = HttpTestUtils.makeCacheEntry(headers);
+        final HttpRequest result = impl.buildConditionalRequest(requestWrapper, cacheEntry);
         Assert.assertEquals(lmDate,
                 result.getFirstHeader("If-Modified-Since").getValue());
         Assert.assertEquals(etag,
@@ -120,9 +120,9 @@ public class TestConditionalRequestBuild
         final String theUri = "/theuri";
         final String theETag = "this is my eTag";
 
-        final HttpRequest request = new BasicHttpRequest(theMethod, theUri);
-        request.addHeader("Accept-Encoding", "gzip");
-        final HttpRequestWrapper requestWrapper = HttpRequestWrapper.wrap(request);
+        final HttpRequest basicRequest = new BasicHttpRequest(theMethod, theUri);
+        basicRequest.addHeader("Accept-Encoding", "gzip");
+        final HttpRequestWrapper requestWrapper = HttpRequestWrapper.wrap(basicRequest);
 
         final Header[] headers = new Header[] {
                 new BasicHeader("Date", DateUtils.formatDate(new Date())),
@@ -133,11 +133,11 @@ public class TestConditionalRequestBuild
 
         final HttpRequest newRequest = impl.buildConditionalRequest(requestWrapper, cacheEntry);
 
-        Assert.assertNotSame(request, newRequest);
+        Assert.assertNotSame(basicRequest, newRequest);
 
         Assert.assertEquals(theMethod, newRequest.getRequestLine().getMethod());
         Assert.assertEquals(theUri, newRequest.getRequestLine().getUri());
-        Assert.assertEquals(request.getRequestLine().getProtocolVersion(), newRequest
+        Assert.assertEquals(basicRequest.getRequestLine().getProtocolVersion(), newRequest
                 .getRequestLine().getProtocolVersion());
 
         Assert.assertEquals(3, newRequest.getAllHeaders().length);
@@ -151,8 +151,8 @@ public class TestConditionalRequestBuild
 
     @Test
     public void testCacheEntryWithMustRevalidateDoesEndToEndRevalidation() throws Exception
{
-        final HttpRequest request = new BasicHttpRequest("GET","/",HttpVersion.HTTP_1_1);
-        final HttpRequestWrapper requestWrapper = HttpRequestWrapper.wrap(request);
+        final HttpRequest basicRequest = new BasicHttpRequest("GET","/",HttpVersion.HTTP_1_1);
+        final HttpRequestWrapper requestWrapper = HttpRequestWrapper.wrap(basicRequest);
         final Date now = new Date();
         final Date elevenSecondsAgo = new Date(now.getTime() - 11 * 1000L);
         final Date tenSecondsAgo = new Date(now.getTime() - 10 * 1000L);
@@ -180,8 +180,8 @@ public class TestConditionalRequestBuild
 
     @Test
     public void testCacheEntryWithProxyRevalidateDoesEndToEndRevalidation() throws Exception
{
-        final HttpRequest request = new BasicHttpRequest("GET","/",HttpVersion.HTTP_1_1);
-        final HttpRequestWrapper requestWrapper = HttpRequestWrapper.wrap(request);
+        final HttpRequest basicRequest = new BasicHttpRequest("GET","/",HttpVersion.HTTP_1_1);
+        final HttpRequestWrapper requestWrapper = HttpRequestWrapper.wrap(basicRequest);
         final Date now = new Date();
         final Date elevenSecondsAgo = new Date(now.getTime() - 11 * 1000L);
         final Date tenSecondsAgo = new Date(now.getTime() - 10 * 1000L);

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java?rev=1571371&r1=1571370&r2=1571371&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java
Mon Feb 24 18:03:43 2014
@@ -4842,12 +4842,12 @@ public class TestProtocolRequirements ex
     }
 
     protected HttpRequestWrapper makeRequestWithBody(final String method, final String requestUri)
{
-        final HttpEntityEnclosingRequest request =
+        final HttpEntityEnclosingRequest req =
             new BasicHttpEntityEnclosingRequest(method, requestUri, HttpVersion.HTTP_1_1);
         final int nbytes = 128;
-        request.setEntity(HttpTestUtils.makeBody(nbytes));
-        request.setHeader("Content-Length",""+nbytes);
-        return HttpRequestWrapper.wrap(request);
+        req.setEntity(HttpTestUtils.makeBody(nbytes));
+        req.setHeader("Content-Length",""+nbytes);
+        return HttpRequestWrapper.wrap(req);
     }
 
     @Test

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestRFC5861Compliance.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestRFC5861Compliance.java?rev=1571371&r1=1571370&r2=1571371&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestRFC5861Compliance.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestRFC5861Compliance.java
Mon Feb 24 18:03:43 2014
@@ -101,8 +101,8 @@ public class TestRFC5861Compliance exten
 
         final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(HttpTestUtils.makeDefaultRequest());
         final HttpResponse resp2 = HttpTestUtils.make500Response();
-        final byte[] body = HttpTestUtils.getRandomBytes(101);
-        final ByteArrayInputStream buf = new ByteArrayInputStream(body);
+        final byte[] body101 = HttpTestUtils.getRandomBytes(101);
+        final ByteArrayInputStream buf = new ByteArrayInputStream(body101);
         final ConsumableInputStream cis = new ConsumableInputStream(buf);
         final HttpEntity entity = new InputStreamEntity(cis, 101);
         resp2.setEntity(entity);
@@ -167,9 +167,9 @@ public class TestRFC5861Compliance exten
     @Test
     public void testStaleIfErrorInResponseNeedNotYieldToProxyRevalidateForPrivateCache()
             throws Exception{
-        final CacheConfig config = CacheConfig.custom()
+        final CacheConfig configUnshared = CacheConfig.custom()
                 .setSharedCache(false).build();
-        impl = new CachingExec(mockBackend, new BasicHttpCache(config), config);
+        impl = new CachingExec(mockBackend, new BasicHttpCache(configUnshared), configUnshared);
 
         final Date tenSecondsAgo = new Date(new Date().getTime() - 10 * 1000L);
         final HttpRequestWrapper req1 = HttpRequestWrapper.wrap(HttpTestUtils.makeDefaultRequest());

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestRequestProtocolCompliance.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestRequestProtocolCompliance.java?rev=1571371&r1=1571370&r2=1571371&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestRequestProtocolCompliance.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestRequestProtocolCompliance.java
Mon Feb 24 18:03:43 2014
@@ -91,10 +91,10 @@ public class TestRequestProtocolComplian
 
     @Test
     public void removesEntityFromTRACERequest() throws Exception {
-        final HttpEntityEnclosingRequest req =
+        final HttpEntityEnclosingRequest reqst =
             new BasicHttpEntityEnclosingRequest("TRACE", "/", HttpVersion.HTTP_1_1);
-        req.setEntity(HttpTestUtils.makeBody(50));
-        final HttpRequestWrapper wrapper = HttpRequestWrapper.wrap(req);
+        reqst.setEntity(HttpTestUtils.makeBody(50));
+        final HttpRequestWrapper wrapper = HttpRequestWrapper.wrap(reqst);
         impl.makeRequestCompliant(wrapper);
         if (wrapper instanceof HttpEntityEnclosingRequest) {
             assertNull(((HttpEntityEnclosingRequest) wrapper).getEntity());

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/memcached/TestMemcachedCacheEntryImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/memcached/TestMemcachedCacheEntryImpl.java?rev=1571371&r1=1571370&r2=1571371&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/memcached/TestMemcachedCacheEntryImpl.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/memcached/TestMemcachedCacheEntryImpl.java
Mon Feb 24 18:03:43 2014
@@ -79,13 +79,13 @@ public class TestMemcachedCacheEntryImpl
     @Test
     public void canBeReconstitutedFromByteArray() throws Exception {
         final String key = impl.getStorageKey();
-        final HttpCacheEntry entry = impl.getHttpCacheEntry();
+        final HttpCacheEntry entry1 = impl.getHttpCacheEntry();
         final byte[] bytes = impl.toByteArray();
         impl = new MemcachedCacheEntryImpl();
         impl.set(bytes);
 
         assertEquals(key, impl.getStorageKey());
-        assertEquivalent(entry, impl.getHttpCacheEntry());
+        assertEquivalent(entry1, impl.getHttpCacheEntry());
     }
 
     @Test(expected=MemcachedSerializationException.class)

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/methods/RequestBuilder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/methods/RequestBuilder.java?rev=1571371&r1=1571370&r2=1571371&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/methods/RequestBuilder.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/methods/RequestBuilder.java
Mon Feb 24 18:03:43 2014
@@ -286,7 +286,7 @@ public class RequestBuilder {
 
     public HttpUriRequest build() {
         final HttpRequestBase result;
-        URI uri = this.uri != null ? this.uri : URI.create("/");
+        URI uriNotNull = this.uri != null ? this.uri : URI.create("/");
         HttpEntity entity = this.entity;
         if (parameters != null && !parameters.isEmpty()) {
             if (entity == null && (HttpPost.METHOD_NAME.equalsIgnoreCase(method)
@@ -294,7 +294,7 @@ public class RequestBuilder {
                 entity = new UrlEncodedFormEntity(parameters, HTTP.DEF_CONTENT_CHARSET);
             } else {
                 try {
-                    uri = new URIBuilder(uri).addParameters(parameters).build();
+                    uriNotNull = new URIBuilder(uriNotNull).addParameters(parameters).build();
                 } catch (final URISyntaxException ex) {
                     // should never happen
                 }
@@ -308,7 +308,7 @@ public class RequestBuilder {
             result = request;
         }
         result.setProtocolVersion(this.version);
-        result.setURI(uri);
+        result.setURI(uriNotNull);
         if (this.headergroup != null) {
             result.setHeaders(this.headergroup.getAllHeaders());
         }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java?rev=1571371&r1=1571370&r2=1571371&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java
Mon Feb 24 18:03:43 2014
@@ -91,9 +91,9 @@ public abstract class GGSSchemeBase exte
 
     protected byte[] generateGSSToken(
             final byte[] input, final Oid oid, final String authServer) throws GSSException
{
-        byte[] token = input;
-        if (token == null) {
-            token = new byte[0];
+        byte[] inputBuff = input;
+        if (inputBuff == null) {
+            inputBuff = new byte[0];
         }
         final GSSManager manager = getManager();
         final GSSName serverName = manager.createName("HTTP@" + authServer, GSSName.NT_HOSTBASED_SERVICE);
@@ -101,7 +101,7 @@ public abstract class GGSSchemeBase exte
                 serverName.canonicalize(oid), oid, null, GSSContext.DEFAULT_LIFETIME);
         gssContext.requestMutualAuth(true);
         gssContext.requestCredDeleg(true);
-        return gssContext.initSecContext(token, 0, token.length);
+        return gssContext.initSecContext(inputBuff, 0, inputBuff.length);
     }
 
     protected abstract byte[] generateToken(

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/RequestWrapper.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/RequestWrapper.java?rev=1571371&r1=1571370&r2=1571371&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/RequestWrapper.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/RequestWrapper.java
Mon Feb 24 18:03:43 2014
@@ -129,7 +129,6 @@ public class RequestWrapper extends Abst
 
     @Override
     public RequestLine getRequestLine() {
-        final String method = getMethod();
         final ProtocolVersion ver = getProtocolVersion();
         String uritext = null;
         if (uri != null) {
@@ -138,7 +137,7 @@ public class RequestWrapper extends Abst
         if (uritext == null || uritext.isEmpty()) {
             uritext = "/";
         }
-        return new BasicRequestLine(method, uritext, ver);
+        return new BasicRequestLine(getMethod(), uritext, ver);
     }
 
     @Override

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestPoolingHttpClientConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestPoolingHttpClientConnectionManager.java?rev=1571371&r1=1571370&r2=1571371&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestPoolingHttpClientConnectionManager.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestPoolingHttpClientConnectionManager.java
Mon Feb 24 18:03:43 2014
@@ -60,6 +60,7 @@ import org.mockito.MockitoAnnotations;
 /**
  * {@link PoolingHttpClientConnectionManager} tests.
  */
+@SuppressWarnings({"boxing","static-access","resource"}) // test code
 public class TestPoolingHttpClientConnectionManager {
 
     @Mock
@@ -300,7 +301,7 @@ public class TestPoolingHttpClientConnec
 
         final ConnectionSocketFactory plainsf = Mockito.mock(ConnectionSocketFactory.class);
         final LayeredConnectionSocketFactory sslsf = Mockito.mock(LayeredConnectionSocketFactory.class);
-        final Socket socket = Mockito.mock(Socket.class);
+        final Socket mockSock = Mockito.mock(Socket.class);
         final HttpClientContext context = HttpClientContext.create();
         final SocketConfig sconfig = SocketConfig.custom().build();
         final ConnectionConfig cconfig = ConnectionConfig.custom().build();
@@ -313,31 +314,31 @@ public class TestPoolingHttpClientConnec
         Mockito.when(schemePortResolver.resolve(target)).thenReturn(8443);
         Mockito.when(socketFactoryRegistry.lookup("http")).thenReturn(plainsf);
         Mockito.when(socketFactoryRegistry.lookup("https")).thenReturn(sslsf);
-        Mockito.when(plainsf.createSocket(Mockito.<HttpContext>any())).thenReturn(socket);
+        Mockito.when(plainsf.createSocket(Mockito.<HttpContext>any())).thenReturn(mockSock);
         Mockito.when(plainsf.connectSocket(
                 Mockito.anyInt(),
-                Mockito.eq(socket),
+                Mockito.eq(mockSock),
                 Mockito.<HttpHost>any(),
                 Mockito.<InetSocketAddress>any(),
                 Mockito.<InetSocketAddress>any(),
-                Mockito.<HttpContext>any())).thenReturn(socket);
+                Mockito.<HttpContext>any())).thenReturn(mockSock);
 
         mgr.connect(conn1, route, 123, context);
 
         Mockito.verify(dnsResolver, Mockito.times(1)).resolve("someproxy");
         Mockito.verify(schemePortResolver, Mockito.times(1)).resolve(proxy);
         Mockito.verify(plainsf, Mockito.times(1)).createSocket(context);
-        Mockito.verify(plainsf, Mockito.times(1)).connectSocket(123, socket, proxy,
+        Mockito.verify(plainsf, Mockito.times(1)).connectSocket(123, mockSock, proxy,
                 new InetSocketAddress(remote, 8080),
                 new InetSocketAddress(local, 0), context);
 
-        Mockito.when(conn.getSocket()).thenReturn(socket);
+        Mockito.when(conn.getSocket()).thenReturn(mockSock);
 
         mgr.upgrade(conn1, route, context);
 
         Mockito.verify(schemePortResolver, Mockito.times(1)).resolve(target);
         Mockito.verify(sslsf, Mockito.times(1)).createLayeredSocket(
-                socket, "somehost", 8443, context);
+                mockSock, "somehost", 8443, context);
 
         mgr.routeComplete(conn1, route, context);
     }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestRetryExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestRetryExec.java?rev=1571371&r1=1571370&r2=1571371&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestRetryExec.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestRetryExec.java
Mon Feb 24 18:03:43 2014
@@ -27,6 +27,7 @@
 package org.apache.http.impl.execchain;
 
 import junit.framework.Assert;
+
 import org.apache.http.Header;
 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpHost;
@@ -52,6 +53,7 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
+@SuppressWarnings({"boxing","static-access","resource"}) // test code
 public class TestRetryExec {
 
     @Mock
@@ -165,8 +167,8 @@ public class TestRetryExec {
             @Override
             public Object answer(final InvocationOnMock invocationOnMock) throws Throwable
{
                 final Object[] args = invocationOnMock.getArguments();
-                final HttpEntityEnclosingRequest request = (HttpEntityEnclosingRequest) args[1];
-                request.getEntity().writeTo(new ByteArrayOutputStream());
+                final HttpEntityEnclosingRequest req = (HttpEntityEnclosingRequest) args[1];
+                req.getEntity().writeTo(new ByteArrayOutputStream());
                 throw new IOException("Ka-boom");
             }
 



Mime
View raw message