hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1681461 [1/3] - in /httpcomponents/httpclient/trunk: ./ fluent-hc/src/examples/org/apache/http/client/fluent/ fluent-hc/src/main/java/org/apache/http/client/fluent/ httpclient-cache/src/main/java/org/apache/http/client/cache/ httpclient-ca...
Date Sun, 24 May 2015 14:24:28 GMT
Author: olegk
Date: Sun May 24 14:24:26 2015
New Revision: 1681461

URL: http://svn.apache.org/r1681461
Log:
Upgraded to Java 1.7

Modified:
    httpcomponents/httpclient/trunk/fluent-hc/src/examples/org/apache/http/client/fluent/FluentAsync.java
    httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Async.java
    httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
    httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Form.java
    httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalFileEntity.java
    httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalHttpRequest.java
    httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalInputStreamEntity.java
    httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java
    httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheEntry.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/AsynchronousValidationRequest.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/AsynchronousValidator.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntity.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntryUpdater.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheKeyGenerator.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingExec.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CombinedEntity.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultFailureCache.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultHttpCacheEntrySerializer.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResourceFactory.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ManagedHttpCacheStorage.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/RequestProtocolCompliance.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/WarningValue.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/memcached/MemcachedCacheEntryImpl.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/client/cache/TestHttpCacheEntry.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/HttpTestUtils.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/SimpleHttpCacheStorage.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestBasicHttpCache.java
    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/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/TestHttpCacheEntrySerializers.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRecommendations.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/TestSizeLimitedResponseReader.java
    httpcomponents/httpclient/trunk/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/HttpProxyConfigurationActivator.java
    httpcomponents/httpclient/trunk/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/PropertiesUtils.java
    httpcomponents/httpclient/trunk/httpclient-win/src/test/java/org/apache/http/impl/auth/win/TestWindowsNegotiateScheme.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAbortMethod.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAuthentication.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientChunkEncodedPost.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomContext.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomPublicSuffixList.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomSSL.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientEvictExpiredConnections.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteSOCKS.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientFormLogin.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientMultiThreadedExecution.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveBasicAuthentication.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveDigestAuthentication.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientProxyAuthentication.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientWithRequestFuture.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientWithResponseHandler.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ProxyTunnelDemo.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/entity/DecompressingEntity.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/methods/AbstractExecutionAwareRequest.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/methods/HttpOptions.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/client/protocol/RequestAddCookies.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/DateUtils.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIBuilder.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixListParser.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixMatcher.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/util/PublicSuffixMatcherLoader.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/DigestScheme.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/RFC2617Scheme.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AIMDBackoffManager.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicAuthCache.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicCookieStore.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicCredentialsProvider.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/FutureRequestExecutionService.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/RedirectLocations.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/StandardHttpRequestRetryHandler.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultManagedHttpClientConnection.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/InMemoryDnsResolver.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/AbstractCookieSpec.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BasicClientCookie.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/LaxExpiresHandler.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftHeaderParser.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpec.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265CookieSpec.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestDefaultHeaders.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURIBuilder.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURLEncodedUtils.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/routing/TestHttpRoute.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/routing/TestRouteTracker.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestDigestScheme.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestHttpAuthenticator.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/MockConnPoolControl.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAuthenticationStrategy.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestFutureRequestExecutionService.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestBasicConnectionManager.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestContentCodings.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookieVirtualHost.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestMalformedServerResponse.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestMinimalClientRequestExecution.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestSystemDefaultRoutePlanner.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieNetscapeDraft.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2109Spec.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2965Spec.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestDefaultCookieSpec.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestMainClientExec.java
    httpcomponents/httpclient/trunk/httpmime/src/examples/org/apache/http/examples/entity/mime/ClientMultipartFormPost.java
    httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/Header.java
    httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java
    httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/content/FileBody.java
    httpcomponents/httpclient/trunk/httpmime/src/test/java/org/apache/http/entity/mime/TestMultipartForm.java
    httpcomponents/httpclient/trunk/pom.xml

Modified: httpcomponents/httpclient/trunk/fluent-hc/src/examples/org/apache/http/client/fluent/FluentAsync.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/fluent-hc/src/examples/org/apache/http/client/fluent/FluentAsync.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/fluent-hc/src/examples/org/apache/http/client/fluent/FluentAsync.java (original)
+++ httpcomponents/httpclient/trunk/fluent-hc/src/examples/org/apache/http/client/fluent/FluentAsync.java Sun May 24 14:24:26 2015
@@ -54,7 +54,7 @@ public class FluentAsync {
         };
 
 
-        Queue<Future<Content>> queue = new LinkedList<Future<Content>>();
+        Queue<Future<Content>> queue = new LinkedList<>();
         // Execute requests asynchronously
         for (final Request request: requests) {
             Future<Content> future = async.execute(request, new FutureCallback<Content>() {

Modified: httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Async.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Async.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Async.java (original)
+++ httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Async.java Sun May 24 14:24:26 2015
@@ -89,8 +89,8 @@ public class Async {
 
     public <T> Future<T> execute(
             final Request request, final ResponseHandler<T> handler, final FutureCallback<T> callback) {
-        final BasicFuture<T> future = new BasicFuture<T>(callback);
-        final ExecRunnable<T> runnable = new ExecRunnable<T>(
+        final BasicFuture<T> future = new BasicFuture<>(callback);
+        final ExecRunnable<T> runnable = new ExecRunnable<>(
                 future,
                 request,
                 this.executor != null ? this.executor : Executor.newInstance(),

Modified: httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java (original)
+++ httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java Sun May 24 14:24:26 2015
@@ -82,9 +82,7 @@ public class Executor {
                 sslcontext = SSLContext.getInstance(SSLConnectionSocketFactory.TLS);
                 sslcontext.init(null, null, null);
                 ssl = new SSLConnectionSocketFactory(sslcontext);
-            } catch (final SecurityException ignore) {
-            } catch (final KeyManagementException ignore) {
-            } catch (final NoSuchAlgorithmException ignore) {
+            } catch (final SecurityException | NoSuchAlgorithmException | KeyManagementException ignore) {
             }
         }
 

Modified: httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Form.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Form.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Form.java (original)
+++ httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Form.java Sun May 24 14:24:26 2015
@@ -42,7 +42,7 @@ public class Form {
 
     Form() {
         super();
-        this.params = new ArrayList<NameValuePair>();
+        this.params = new ArrayList<>();
     }
 
     public Form add(final String name, final String value) {
@@ -51,7 +51,7 @@ public class Form {
     }
 
     public List<NameValuePair> build() {
-        return new ArrayList<NameValuePair>(this.params);
+        return new ArrayList<>(this.params);
     }
 
 }

Modified: httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalFileEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalFileEntity.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalFileEntity.java (original)
+++ httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalFileEntity.java Sun May 24 14:24:26 2015
@@ -67,16 +67,13 @@ class InternalFileEntity extends Abstrac
     @Override
     public void writeTo(final OutputStream outstream) throws IOException {
         Args.notNull(outstream, "Output stream");
-        final InputStream instream = new FileInputStream(this.file);
-        try {
+        try (InputStream instream = new FileInputStream(this.file)) {
             final byte[] tmp = new byte[4096];
             int l;
             while ((l = instream.read(tmp)) != -1) {
                 outstream.write(tmp, 0, l);
             }
             outstream.flush();
-        } finally {
-            instream.close();
         }
     }
 

Modified: httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalHttpRequest.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalHttpRequest.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalHttpRequest.java (original)
+++ httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalHttpRequest.java Sun May 24 14:24:26 2015
@@ -62,7 +62,7 @@ class InternalHttpRequest extends Abstra
         this.method = method;
         this.uri = requestURI;
         this.aborted = new AtomicBoolean(false);
-        this.cancellableRef = new AtomicReference<Cancellable>(null);
+        this.cancellableRef = new AtomicReference<>(null);
     }
 
     public void setProtocolVersion(final ProtocolVersion version) {

Modified: httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalInputStreamEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalInputStreamEntity.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalInputStreamEntity.java (original)
+++ httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalInputStreamEntity.java Sun May 24 14:24:26 2015
@@ -67,8 +67,7 @@ class InternalInputStreamEntity extends
     @Override
     public void writeTo(final OutputStream outstream) throws IOException {
         Args.notNull(outstream, "Output stream");
-        final InputStream instream = this.content;
-        try {
+        try (InputStream instream = this.content) {
             final byte[] buffer = new byte[4096];
             int l;
             if (this.length < 0) {
@@ -80,7 +79,7 @@ class InternalInputStreamEntity extends
                 // consume no more than length
                 long remaining = this.length;
                 while (remaining > 0) {
-                    l = instream.read(buffer, 0, (int)Math.min(4096, remaining));
+                    l = instream.read(buffer, 0, (int) Math.min(4096, remaining));
                     if (l == -1) {
                         break;
                     }
@@ -88,8 +87,6 @@ class InternalInputStreamEntity extends
                     remaining -= l;
                 }
             }
-        } finally {
-            instream.close();
         }
     }
 

Modified: httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java (original)
+++ httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java Sun May 24 14:24:26 2015
@@ -309,7 +309,7 @@ public class Request {
     }
 
     public Request bodyForm(final Iterable <? extends NameValuePair> formParams, final Charset charset) {
-        final List<NameValuePair> paramList = new ArrayList<NameValuePair>();
+        final List<NameValuePair> paramList = new ArrayList<>();
         for (NameValuePair param : formParams) {
             paramList.add(param);
         }

Modified: httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java (original)
+++ httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java Sun May 24 14:24:26 2015
@@ -121,15 +121,14 @@ public class Response {
             throw new HttpResponseException(statusLine.getStatusCode(),
                     statusLine.getReasonPhrase());
         }
-        final FileOutputStream out = new FileOutputStream(file);
-        try {
+        try (FileOutputStream out = new FileOutputStream(file)) {
             final HttpEntity entity = this.response.getEntity();
             if (entity != null) {
                 entity.writeTo(out);
             }
         } finally {
             this.consumed = true;
-            out.close();
+
         }
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheEntry.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheEntry.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheEntry.java Sun May 24 14:24:26 2015
@@ -104,7 +104,7 @@ public class HttpCacheEntry implements S
         this.responseHeaders.setHeaders(responseHeaders);
         this.resource = resource;
         this.variantMap = variantMap != null
-            ? new HashMap<String,String>(variantMap)
+            ? new HashMap<>(variantMap)
             : null;
         this.date = parseDate();
     }

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/AsynchronousValidationRequest.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/AsynchronousValidationRequest.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/AsynchronousValidationRequest.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/AsynchronousValidationRequest.java Sun May 24 14:24:26 2015
@@ -110,12 +110,9 @@ public class AsynchronousValidationReque
      */
     private boolean revalidateCacheEntry() {
         try {
-            final CloseableHttpResponse httpResponse = cachingExec.revalidateCacheEntry(route, request, context, execAware, cacheEntry);
-            try {
+            try (CloseableHttpResponse httpResponse = cachingExec.revalidateCacheEntry(route, request, context, execAware, cacheEntry)) {
                 final int statusCode = httpResponse.getStatusLine().getStatusCode();
                 return isNotServerError(statusCode) && isNotStale(httpResponse);
-            } finally {
-                httpResponse.close();
             }
         } catch (final IOException ioe) {
             log.debug("Asynchronous revalidation failed due to I/O error", ioe);

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/AsynchronousValidator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/AsynchronousValidator.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/AsynchronousValidator.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/AsynchronousValidator.java Sun May 24 14:24:26 2015
@@ -76,7 +76,7 @@ class AsynchronousValidator implements C
      */
     AsynchronousValidator(final SchedulingStrategy schedulingStrategy) {
         this.schedulingStrategy = schedulingStrategy;
-        this.queued = new HashSet<String>();
+        this.queued = new HashSet<>();
         this.cacheKeyGenerator = new CacheKeyGenerator();
         this.failureCache = new DefaultFailureCache();
     }

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java Sun May 24 14:24:26 2015
@@ -57,7 +57,7 @@ import org.apache.http.message.BasicHttp
 import org.apache.http.protocol.HTTP;
 
 class BasicHttpCache implements HttpCache {
-    private static final Set<String> safeRequestMethods = new HashSet<String>(
+    private static final Set<String> safeRequestMethods = new HashSet<>(
             Arrays.asList(HeaderConstants.HEAD_METHOD,
                     HeaderConstants.GET_METHOD, HeaderConstants.OPTIONS_METHOD,
                     HeaderConstants.TRACE_METHOD));
@@ -245,7 +245,7 @@ class BasicHttpCache implements HttpCach
         if (src.getResource() != null) {
             resource = resourceFactory.copy(requestId, src.getResource());
         }
-        final Map<String,String> variantMap = new HashMap<String,String>(src.getVariantMap());
+        final Map<String,String> variantMap = new HashMap<>(src.getVariantMap());
         variantMap.put(variantKey, variantCacheKey);
         return new HttpCacheEntry(
                 src.getRequestDate(),
@@ -364,7 +364,7 @@ class BasicHttpCache implements HttpCach
     @Override
     public Map<String, Variant> getVariantCacheEntriesWithEtags(final HttpHost host, final HttpRequest request)
             throws IOException {
-        final Map<String,Variant> variants = new HashMap<String,Variant>();
+        final Map<String,Variant> variants = new HashMap<>();
         final HttpCacheEntry root = storage.getEntry(uriExtractor.getURI(host, request));
         if (root == null || !root.hasVariants()) {
             return variants;

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntity.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntity.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheEntity.java Sun May 24 14:24:26 2015
@@ -83,11 +83,8 @@ class CacheEntity implements HttpEntity,
     @Override
     public void writeTo(final OutputStream outstream) throws IOException {
         Args.notNull(outstream, "Output stream");
-        final InputStream instream = this.cacheEntry.getResource().getInputStream();
-        try {
+        try (InputStream instream = this.cacheEntry.getResource().getInputStream()) {
             IOUtils.copy(instream, outstream);
-        } finally {
-            instream.close();
         }
     }
 

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=1681461&r1=1681460&r2=1681461&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 Sun May 24 14:24:26 2015
@@ -108,7 +108,7 @@ class CacheEntryUpdater {
             return entry.getAllHeaders();
         }
 
-        final List<Header> cacheEntryHeaderList = new ArrayList<Header>(Arrays.asList(entry
+        final List<Header> cacheEntryHeaderList = new ArrayList<>(Arrays.asList(entry
                 .getAllHeaders()));
         removeCacheHeadersThatMatchResponse(cacheEntryHeaderList, response);
         removeCacheEntry1xxWarnings(cacheEntryHeaderList, entry);

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=1681461&r1=1681460&r2=1681461&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 Sun May 24 14:24:26 2015
@@ -146,7 +146,7 @@ class CacheKeyGenerator {
      * @return a {@code String} variant key
      */
     public String getVariantKey(final HttpRequest req, final HttpCacheEntry entry) {
-        final List<String> variantHeaderNames = new ArrayList<String>();
+        final List<String> variantHeaderNames = new ArrayList<>();
         for (final Header varyHdr : entry.getHeaders(HeaderConstants.VARY)) {
             for (final HeaderElement elt : varyHdr.getElements()) {
                 variantHeaderNames.add(elt.getName());

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=1681461&r1=1681460&r2=1681461&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 Sun May 24 14:24:26 2015
@@ -108,7 +108,7 @@ public class CachingExec implements Clie
     private final AtomicLong cacheMisses = new AtomicLong();
     private final AtomicLong cacheUpdates = new AtomicLong();
 
-    private final Map<ProtocolVersion, String> viaHeaders = new HashMap<ProtocolVersion, String>(4);
+    private final Map<ProtocolVersion, String> viaHeaders = new HashMap<>(4);
 
     private final CacheConfig cacheConfig;
     private final ClientExecChain backend;
@@ -594,10 +594,7 @@ public class CachingExec implements Clie
             backendResponse.addHeader("Via", generateViaHeader(backendResponse));
             return handleBackendResponse(request, context, requestDate, getCurrentDate(),
                     backendResponse);
-        } catch (final IOException ex) {
-            backendResponse.close();
-            throw ex;
-        } catch (final RuntimeException ex) {
+        } catch (final IOException | RuntimeException ex) {
             backendResponse.close();
             throw ex;
         }
@@ -685,10 +682,7 @@ public class CachingExec implements Clie
                 return responseGenerator.generateNotModifiedResponse(responseEntry);
             }
             return resp;
-        } catch (final IOException ex) {
-            backendResponse.close();
-            throw ex;
-        } catch (final RuntimeException ex) {
+        } catch (final IOException | RuntimeException ex) {
             backendResponse.close();
             throw ex;
         }

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CombinedEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CombinedEntity.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CombinedEntity.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CombinedEntity.java Sun May 24 14:24:26 2015
@@ -73,15 +73,12 @@ class CombinedEntity extends AbstractHtt
     @Override
     public void writeTo(final OutputStream outstream) throws IOException {
         Args.notNull(outstream, "Output stream");
-        final InputStream instream = getContent();
-        try {
+        try (InputStream instream = getContent()) {
             int l;
             final byte[] tmp = new byte[2048];
             while ((l = instream.read(tmp)) != -1) {
                 outstream.write(tmp, 0, l);
             }
-        } finally {
-            instream.close();
         }
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultFailureCache.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultFailureCache.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultFailureCache.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/DefaultFailureCache.java Sun May 24 14:24:26 2015
@@ -61,7 +61,7 @@ public class DefaultFailureCache impleme
      */
     public DefaultFailureCache(final int maxSize) {
         this.maxSize = maxSize;
-        this.storage = new ConcurrentHashMap<String, FailureCacheValue>();
+        this.storage = new ConcurrentHashMap<>();
     }
 
     @Override

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=1681461&r1=1681460&r2=1681461&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 Sun May 24 14:24:26 2015
@@ -50,23 +50,17 @@ public class DefaultHttpCacheEntrySerial
 
     @Override
     public void writeTo(final HttpCacheEntry cacheEntry, final OutputStream os) throws IOException {
-        final ObjectOutputStream oos = new ObjectOutputStream(os);
-        try {
+        try (ObjectOutputStream oos = new ObjectOutputStream(os)) {
             oos.writeObject(cacheEntry);
-        } finally {
-            oos.close();
         }
     }
 
     @Override
     public HttpCacheEntry readFrom(final InputStream is) throws IOException {
-        final ObjectInputStream ois = new ObjectInputStream(is);
-        try {
+        try (ObjectInputStream ois = new ObjectInputStream(is)) {
             return (HttpCacheEntry) ois.readObject();
         } catch (final ClassNotFoundException ex) {
             throw new HttpCacheEntrySerializationException("Class not found: " + ex.getMessage(), ex);
-        } finally {
-            ois.close();
         }
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResourceFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResourceFactory.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResourceFactory.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResourceFactory.java Sun May 24 14:24:26 2015
@@ -75,8 +75,7 @@ public class FileResourceFactory impleme
             final InputStream instream,
             final InputLimit limit) throws IOException {
         final File file = generateUniqueCacheFile(requestId);
-        final FileOutputStream outstream = new FileOutputStream(file);
-        try {
+        try (FileOutputStream outstream = new FileOutputStream(file)) {
             final byte[] buf = new byte[2048];
             long total = 0;
             int l;
@@ -88,8 +87,6 @@ public class FileResourceFactory impleme
                     break;
                 }
             }
-        } finally {
-            outstream.close();
         }
         return new FileResource(file);
     }

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=1681461&r1=1681460&r2=1681461&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 Sun May 24 14:24:26 2015
@@ -81,8 +81,8 @@ public class ManagedHttpCacheStorage imp
     public ManagedHttpCacheStorage(final CacheConfig config) {
         super();
         this.entries = new CacheMap(config.getMaxCacheEntries());
-        this.morque = new ReferenceQueue<HttpCacheEntry>();
-        this.resources = new HashSet<ResourceReference>();
+        this.morque = new ReferenceQueue<>();
+        this.resources = new HashSet<>();
         this.active = new AtomicBoolean(true);
     }
 

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=1681461&r1=1681460&r2=1681461&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 Sun May 24 14:24:26 2015
@@ -77,7 +77,7 @@ class RequestProtocolCompliance {
      * @return list of {@link RequestProtocolError}
      */
     public List<RequestProtocolError> requestIsFatallyNonCompliant(final HttpRequest request) {
-        final List<RequestProtocolError> theErrors = new ArrayList<RequestProtocolError>();
+        final List<RequestProtocolError> theErrors = new ArrayList<>();
 
         RequestProtocolError anError = requestHasWeakETagAndRange(request);
         if (anError != null) {
@@ -125,7 +125,7 @@ class RequestProtocolCompliance {
     }
 
     private void stripOtherFreshnessDirectivesWithNoCache(final HttpRequest request) {
-        final List<HeaderElement> outElts = new ArrayList<HeaderElement>();
+        final List<HeaderElement> outElts = new ArrayList<>();
         boolean shouldStrip = false;
         for(final Header h : request.getHeaders(HeaderConstants.CACHE_CONTROL)) {
             for(final HeaderElement elt : h.getElements()) {
@@ -216,7 +216,7 @@ class RequestProtocolCompliance {
         boolean hasHeader = false;
 
         final Header[] expectHeaders = request.getHeaders(HTTP.EXPECT_DIRECTIVE);
-        List<HeaderElement> expectElementsThatAreNot100Continue = new ArrayList<HeaderElement>();
+        List<HeaderElement> expectElementsThatAreNot100Continue = new ArrayList<>();
 
         for (final Header h : expectHeaders) {
             for (final HeaderElement elt : h.getElements()) {
@@ -235,7 +235,7 @@ class RequestProtocolCompliance {
                 }
                 return;
             } else {
-                expectElementsThatAreNot100Continue = new ArrayList<HeaderElement>();
+                expectElementsThatAreNot100Continue = new ArrayList<>();
             }
         }
     }

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java Sun May 24 14:24:26 2015
@@ -110,7 +110,7 @@ class ResponseProtocolCompliance {
             return;
         }
 
-        final List<Header> newWarningHeaders = new ArrayList<Header>();
+        final List<Header> newWarningHeaders = new ArrayList<>();
         boolean modified = false;
         for(final Header h : warningHeaders) {
             for(final WarningValue wv : WarningValue.getWarningValues(h)) {
@@ -135,7 +135,7 @@ class ResponseProtocolCompliance {
         if (hdrs == null || hdrs.length == 0) {
             return;
         }
-        final List<Header> newHeaders = new ArrayList<Header>();
+        final List<Header> newHeaders = new ArrayList<>();
         boolean modified = false;
         for (final Header h : hdrs) {
             final StringBuilder buf = new StringBuilder();

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/WarningValue.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/WarningValue.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/WarningValue.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/WarningValue.java Sun May 24 14:24:26 2015
@@ -69,7 +69,7 @@ class WarningValue {
      * @return array of {@code WarnValue} objects
      */
     public static WarningValue[] getWarningValues(final Header h) {
-        final List<WarningValue> out = new ArrayList<WarningValue>();
+        final List<WarningValue> out = new ArrayList<>();
         final String src = h.getValue();
         int offs = 0;
         while(offs < src.length()) {

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/memcached/MemcachedCacheEntryImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/memcached/MemcachedCacheEntryImpl.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/memcached/MemcachedCacheEntryImpl.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/memcached/MemcachedCacheEntryImpl.java Sun May 24 14:24:26 2015
@@ -101,10 +101,8 @@ public class MemcachedCacheEntryImpl imp
             entry = (HttpCacheEntry)ois.readObject();
             ois.close();
             bis.close();
-        } catch (final IOException ioe) {
+        } catch (final IOException | ClassNotFoundException ioe) {
             throw new MemcachedSerializationException(ioe);
-        } catch (final ClassNotFoundException cnfe) {
-            throw new MemcachedSerializationException(cnfe);
         }
         this.key = s;
         this.httpCacheEntry = entry;

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/client/cache/TestHttpCacheEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/client/cache/TestHttpCacheEntry.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/client/cache/TestHttpCacheEntry.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/client/cache/TestHttpCacheEntry.java Sun May 24 14:24:26 2015
@@ -271,7 +271,7 @@ public class TestHttpCacheEntry {
 
     @Test
     public void canRetrieveOriginalVariantMap() {
-        final Map<String,String> variantMap = new HashMap<String,String>();
+        final Map<String,String> variantMap = new HashMap<>();
         variantMap.put("A","B");
         variantMap.put("C","D");
         entry = new HttpCacheEntry(new Date(), new Date(), statusLine,
@@ -285,7 +285,7 @@ public class TestHttpCacheEntry {
 
     @Test
     public void retrievedVariantMapIsNotModifiable() {
-        final Map<String,String> variantMap = new HashMap<String,String>();
+        final Map<String,String> variantMap = new HashMap<>();
         variantMap.put("A","B");
         variantMap.put("C","D");
         entry = new HttpCacheEntry(new Date(), new Date(), statusLine,

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/HttpTestUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/HttpTestUtils.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/HttpTestUtils.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/HttpTestUtils.java Sun May 24 14:24:26 2015
@@ -400,7 +400,7 @@ public class HttpTestUtils {
     }
 
     public static Map<String, String> makeDefaultVariantMap(final String key, final String value) {
-        final Map<String, String> variants = new HashMap<String, String>();
+        final Map<String, String> variants = new HashMap<>();
         variants.put(key, value);
 
         return variants;

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/SimpleHttpCacheStorage.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/SimpleHttpCacheStorage.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/SimpleHttpCacheStorage.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/SimpleHttpCacheStorage.java Sun May 24 14:24:26 2015
@@ -39,7 +39,7 @@ class SimpleHttpCacheStorage implements
     public final Map<String,HttpCacheEntry> map;
 
     public SimpleHttpCacheStorage() {
-        map = new HashMap<String,HttpCacheEntry>();
+        map = new HashMap<>();
     }
 
     @Override

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestBasicHttpCache.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestBasicHttpCache.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestBasicHttpCache.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestBasicHttpCache.java Sun May 24 14:24:26 2015
@@ -318,7 +318,7 @@ public class TestBasicHttpCache {
         final String existingVariantKey = "existingVariantKey";
         final String newVariantCacheKey = "newVariantCacheKey";
         final String newVariantKey = "newVariantKey";
-        final Map<String,String> existingVariants = new HashMap<String,String>();
+        final Map<String,String> existingVariants = new HashMap<>();
         existingVariants.put(existingVariantKey, variantCacheKey);
         final HttpCacheEntry parent = HttpTestUtils.makeCacheEntry(existingVariants);
         final HttpCacheEntry variant = HttpTestUtils.makeCacheEntry();

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=1681461&r1=1681460&r2=1681461&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 Sun May 24 14:24:26 2015
@@ -89,7 +89,7 @@ public class TestCacheInvalidator {
     public void testInvalidatesRequestsThatArentGETorHEAD() throws Exception {
         request = new BasicHttpRequest("POST","/path", HTTP_1_1);
         final String theUri = "http://foo.example.com:80/path";
-        final Map<String,String> variantMap = new HashMap<String,String>();
+        final Map<String,String> variantMap = new HashMap<>();
         cacheEntryHasVariantMap(variantMap);
 
         cacheReturnsEntryForUri(theUri);

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=1681461&r1=1681460&r2=1681461&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 Sun May 24 14:24:26 2015
@@ -301,7 +301,7 @@ public abstract class TestCachingExecCha
     }
 
     protected void requestIsFatallyNonCompliant(final RequestProtocolError error) {
-        final List<RequestProtocolError> errors = new ArrayList<RequestProtocolError>();
+        final List<RequestProtocolError> errors = new ArrayList<>();
         if (error != null) {
             errors.add(error);
         }
@@ -420,7 +420,7 @@ public abstract class TestCachingExecCha
         req.setHeader("Cache-Control", "no-cache");
         final HttpResponse resp = new BasicHttpResponse(HttpVersion.HTTP_1_1,
             HttpStatus.SC_NO_CONTENT, "No Content");
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
 
         backendCaptureRequestAndReturn(cap, resp);
 

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=1681461&r1=1681460&r2=1681461&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 Sun May 24 14:24:26 2015
@@ -315,7 +315,7 @@ public class TestConditionalRequestBuild
         final String etag2 = "\"456\"";
         final String etag3 = "\"789\"";
 
-        final Map<String,Variant> variantEntries = new HashMap<String,Variant>();
+        final Map<String,Variant> variantEntries = new HashMap<>();
         variantEntries.put(etag1, new Variant("A","B",HttpTestUtils.makeCacheEntry(new Header[] { new BasicHeader("ETag", etag1) })));
         variantEntries.put(etag2, new Variant("C","D",HttpTestUtils.makeCacheEntry(new Header[] { new BasicHeader("ETag", etag2) })));
         variantEntries.put(etag3, new Variant("E","F",HttpTestUtils.makeCacheEntry(new Header[] { new BasicHeader("ETag", etag3) })));

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestHttpCacheEntrySerializers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestHttpCacheEntrySerializers.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestHttpCacheEntrySerializers.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestHttpCacheEntrySerializers.java Sun May 24 14:24:26 2015
@@ -89,7 +89,7 @@ public class TestHttpCacheEntrySerialize
 
         final ProtocolVersion pvObj = new ProtocolVersion("HTTP", 1, 1);
         final StatusLine slObj = new BasicStatusLine(pvObj, 200, "ok");
-        final Map<String,String> variantMap = new HashMap<String,String>();
+        final Map<String,String> variantMap = new HashMap<>();
         variantMap.put("test variant 1","true");
         variantMap.put("test variant 2","true");
         final HttpCacheEntry cacheEntry = new HttpCacheEntry(new Date(), new Date(),

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java Sun May 24 14:24:26 2015
@@ -226,7 +226,7 @@ public class TestProtocolDeviations {
         org.easymock.EasyMock.expect(mockBody.getContentLength()).andReturn(-1L).anyTimes();
         post.setEntity(mockBody);
 
-        final Capture<HttpRequestWrapper> reqCap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> reqCap = new Capture<>();
         EasyMock.expect(
                 mockBackend.execute(
                         EasyMock.eq(route),
@@ -268,7 +268,7 @@ public class TestProtocolDeviations {
         options.setEntity(body);
         options.setHeader("Content-Length", "1");
 
-        final Capture<HttpRequestWrapper> reqCap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> reqCap = new Capture<>();
         EasyMock.expect(
                 mockBackend.execute(
                         EasyMock.eq(route),

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRecommendations.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRecommendations.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRecommendations.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRecommendations.java Sun May 24 14:24:26 2015
@@ -245,7 +245,7 @@ public class TestProtocolRecommendations
 
         // cache module does not currently deal with byte ranges, but we want
         // this test to work even if it does some day
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         EasyMock.expect(
                 mockBackend.execute(
                         EasyMock.eq(route),
@@ -647,7 +647,7 @@ public class TestProtocolRecommendations
     private void testDoesNotModifyHeaderOnRequests(final String headerName)
             throws Exception {
         final String headerValue = HttpTestUtils.getCanonicalHeaderValue(request, headerName);
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         EasyMock.expect(
                 mockBackend.execute(
                         EasyMock.eq(route),
@@ -931,7 +931,7 @@ public class TestProtocolRecommendations
 
         backendExpectsAnyRequestAndReturn(resp1);
 
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(
                 new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
         final HttpResponse resp2 = HttpTestUtils.make200Response();
@@ -980,7 +980,7 @@ public class TestProtocolRecommendations
 
         backendExpectsAnyRequestAndReturn(resp1);
 
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(
                 new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
         final HttpResponse resp2 = HttpTestUtils.make200Response();
@@ -1095,7 +1095,7 @@ public class TestProtocolRecommendations
 
         backendExpectsAnyRequestAndReturn(resp2);
 
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         final HttpResponse resp3 = HttpTestUtils.make200Response();
         resp3.setHeader("ETag","\"etag2\"");
         resp3.setHeader("Date", DateUtils.formatDate(now));
@@ -1171,7 +1171,7 @@ public class TestProtocolRecommendations
 
         backendExpectsAnyRequestAndReturn(resp2);
 
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         final HttpRequestWrapper req3 = HttpRequestWrapper.wrap(
                 new BasicHttpRequest("GET","/",HttpVersion.HTTP_1_1));
         req3.setHeader("User-Agent","agent3");
@@ -1349,7 +1349,7 @@ public class TestProtocolRecommendations
         resp1.setHeader("Vary", "User-Agent");
         resp1.setHeader("ETag", "\"etag3\"");
 
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         EasyMock.expect(
                 mockBackend.execute(
                         EasyMock.eq(route),
@@ -1669,7 +1669,7 @@ public class TestProtocolRecommendations
         req1.addHeader("Cache-Control", "max-stale=0, max-age=0");
 
 
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         EasyMock.expect(
                 mockBackend.execute(
                         EasyMock.eq(route),

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=1681461&r1=1681460&r2=1681461&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 Sun May 24 14:24:26 2015
@@ -301,7 +301,7 @@ public class TestProtocolRequirements ex
      */
     private void testOrderOfMultipleHeadersIsPreservedOnRequests(final String h, final HttpRequestWrapper request)
             throws Exception {
-        final Capture<HttpRequestWrapper> reqCapture = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> reqCapture = new Capture<>();
 
         EasyMock.expect(
                 mockBackend.execute(
@@ -557,7 +557,7 @@ public class TestProtocolRequirements ex
     @Test
     public void testUnknownHeadersOnRequestsAreForwarded() throws Exception {
         request.addHeader("X-Unknown-Header", "blahblah");
-        final Capture<HttpRequestWrapper> reqCap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> reqCap = new Capture<>();
         EasyMock.expect(
                 mockBackend.execute(
                         EasyMock.isA(HttpRoute.class),
@@ -611,7 +611,7 @@ public class TestProtocolRequirements ex
         post.setHeader("Content-Length", "128");
         post.setEntity(new BasicHttpEntity());
 
-        final Capture<HttpRequestWrapper> reqCap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> reqCap = new Capture<>();
 
         EasyMock.expect(
                 mockBackend.execute(
@@ -654,7 +654,7 @@ public class TestProtocolRequirements ex
         post.setHeader("Content-Length", "128");
         post.setEntity(new BasicHttpEntity());
 
-        final Capture<HttpRequestWrapper> reqCap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> reqCap = new Capture<>();
 
         EasyMock.expect(
                 mockBackend.execute(
@@ -692,7 +692,7 @@ public class TestProtocolRequirements ex
     @Test
     public void testExpect100ContinueIsNotSentIfThereIsNoRequestBody() throws Exception {
         request.addHeader("Expect", "100-continue");
-        final Capture<HttpRequestWrapper> reqCap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> reqCap = new Capture<>();
         EasyMock.expect(
                 mockBackend.execute(
                         EasyMock.eq(route),
@@ -862,7 +862,7 @@ public class TestProtocolRequirements ex
         request = HttpRequestWrapper.wrap(new BasicHttpRequest("OPTIONS", "*", HttpVersion.HTTP_1_1));
         request.setHeader("Max-Forwards", "7");
 
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
 
         EasyMock.expect(
                 mockBackend.execute(
@@ -888,7 +888,7 @@ public class TestProtocolRequirements ex
     @Test
     public void testDoesNotAddAMaxForwardsHeaderToForwardedOPTIONSRequests() throws Exception {
         request = HttpRequestWrapper.wrap(new BasicHttpRequest("OPTIONS", "/", HttpVersion.HTTP_1_1));
-        final Capture<HttpRequestWrapper> reqCap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> reqCap = new Capture<>();
         EasyMock.expect(
                 mockBackend.execute(
                         EasyMock.eq(route),
@@ -1119,7 +1119,7 @@ public class TestProtocolRequirements ex
         trace.setEntity(HttpTestUtils.makeBody(entityLength));
         trace.setHeader("Content-Length", Integer.toString(entityLength));
 
-        final Capture<HttpRequestWrapper> reqCap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> reqCap = new Capture<>();
 
         EasyMock.expect(
                 mockBackend.execute(
@@ -2241,8 +2241,8 @@ public class TestProtocolRequirements ex
         unconditionalResponse.setHeader("Date", DateUtils.formatDate(inFiveSeconds));
         unconditionalResponse.setHeader("ETag", "\"etag\"");
 
-        final Capture<HttpRequestWrapper> cap1 = new Capture<HttpRequestWrapper>();
-        final Capture<HttpRequestWrapper> cap2 = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap1 = new Capture<>();
+        final Capture<HttpRequestWrapper> cap2 = new Capture<>();
 
         EasyMock.expect(
                 mockBackend.execute(
@@ -2879,7 +2879,7 @@ public class TestProtocolRequirements ex
 
         final CloseableHttpResponse reconstructed = Proxies.enhanceResponse(HttpTestUtils.make200Response());
 
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
 
         mockCache.flushInvalidatedCacheEntriesFor(EasyMock.eq(host), eqRequest(request));
         mockCache.flushInvalidatedCacheEntriesFor(
@@ -2995,7 +2995,7 @@ public class TestProtocolRequirements ex
      */
     private HttpResponse testRequestWithWeakETagValidatorIsNotAllowed(final String header)
             throws Exception {
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         EasyMock.expect(
                 mockBackend.execute(
                         EasyMock.eq(route),
@@ -3137,7 +3137,7 @@ public class TestProtocolRequirements ex
                 new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
         req2.setHeader("Cache-Control", "max-age=0,max-stale=0");
 
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         EasyMock.expect(
                 mockBackend.execute(
                         EasyMock.isA(HttpRoute.class),
@@ -3497,7 +3497,7 @@ public class TestProtocolRequirements ex
         req.setHeader("Content-Length","128");
         req.setHeader(header,value);
 
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
 
         EasyMock.expect(
                 mockBackend.execute(
@@ -3544,7 +3544,7 @@ public class TestProtocolRequirements ex
         req.setHeader("Content-Length","128");
         req.removeHeaders(header);
 
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
 
         EasyMock.expect(
                 mockBackend.execute(
@@ -4577,8 +4577,8 @@ public class TestProtocolRequirements ex
         resp304.setHeader("ETag","\"etag1\"");
         resp304.setHeader("Vary","User-Agent");
 
-        final Capture<HttpRequestWrapper> condCap = new Capture<HttpRequestWrapper>();
-        final Capture<HttpRequestWrapper> uncondCap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> condCap = new Capture<>();
+        final Capture<HttpRequestWrapper> uncondCap = new Capture<>();
 
         EasyMock.expect(
                 mockBackend.execute(
@@ -5131,7 +5131,7 @@ public class TestProtocolRequirements ex
 
             final HttpResponse resp2 = HttpTestUtils.make200Response();
 
-            final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+            final Capture<HttpRequestWrapper> cap = new Capture<>();
             EasyMock.expect(
                     mockBackend.execute(
                             EasyMock.eq(route),
@@ -5209,7 +5209,7 @@ public class TestProtocolRequirements ex
         req2.setHeader("Cache-Control","max-stale=60");
         final HttpResponse resp2 = HttpTestUtils.make200Response();
 
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         EasyMock.expect(
                 mockBackend.execute(
                         EasyMock.eq(route),
@@ -5247,7 +5247,7 @@ public class TestProtocolRequirements ex
     public void testDoesNotTransmitNoCacheDirectivesWithFieldsDownstream()
         throws Exception {
         request.setHeader("Cache-Control","no-cache=\"X-Field\"");
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         EasyMock.expect(mockBackend.execute(
                 EasyMock.eq(route),
                 EasyMock.capture(cap),
@@ -5293,7 +5293,7 @@ public class TestProtocolRequirements ex
         resp2.setHeader("Etag","\"etag2\"");
         resp2.setHeader("Cache-Control","max-age=1200");
 
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         EasyMock.expect(mockBackend.execute(
                 EasyMock.eq(route),
                 EasyMock.capture(cap),
@@ -5352,7 +5352,7 @@ public class TestProtocolRequirements ex
         resp2.setHeader("ETag","\"etag2\"");
         resp2.setHeader("Cache-Control","max-age=5, must-revalidate");
 
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         // this request MUST happen
         EasyMock.expect(
                 mockBackend.execute(
@@ -5607,7 +5607,7 @@ public class TestProtocolRequirements ex
         resp2.setHeader("X-Stuff","things");
         resp2.setHeader("Cache-Control","no-cache=\"X-Stuff\",max-age=3600");
 
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         EasyMock.expect(
                 mockBackend.execute(
                         EasyMock.eq(route),
@@ -5995,7 +5995,7 @@ public class TestProtocolRequirements ex
      */
     @Test
     public void testProperlyFormattedViaHeaderIsAddedToRequests() throws Exception {
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         request.removeHeaders("Via");
         EasyMock.expect(
                 mockBackend.execute(
@@ -6097,7 +6097,7 @@ public class TestProtocolRequirements ex
     throws Exception {
         request = HttpRequestWrapper.wrap(new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_0));
         request.removeHeaders("Via");
-        final Capture<HttpRequestWrapper> cap = new Capture<HttpRequestWrapper>();
+        final Capture<HttpRequestWrapper> cap = new Capture<>();
         EasyMock.expect(
                 mockBackend.execute(
                         EasyMock.isA(HttpRoute.class),

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestSizeLimitedResponseReader.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestSizeLimitedResponseReader.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestSizeLimitedResponseReader.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestSizeLimitedResponseReader.java Sun May 24 14:24:26 2015
@@ -158,8 +158,7 @@ public class TestSizeLimitedResponseRead
 
         impl.readResponse();
         final boolean tooLarge = impl.isLimitReached();
-        final CloseableHttpResponse result = impl.getReconstructedResponse();
-        try {
+        try (CloseableHttpResponse result = impl.getReconstructedResponse()) {
             final HttpEntity reconstructedEntity = result.getEntity();
             Assert.assertEquals(entity.getContentEncoding(), reconstructedEntity.getContentEncoding());
             Assert.assertEquals(entity.getContentType(), reconstructedEntity.getContentType());
@@ -169,8 +168,6 @@ public class TestSizeLimitedResponseRead
 
             Assert.assertTrue(tooLarge);
             Assert.assertEquals("large entity content", content);
-        } finally {
-            result.close();
         }
         Assert.assertTrue(closed.get());
     }

Modified: httpcomponents/httpclient/trunk/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/HttpProxyConfigurationActivator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/HttpProxyConfigurationActivator.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/HttpProxyConfigurationActivator.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/HttpProxyConfigurationActivator.java Sun May 24 14:24:26 2015
@@ -60,9 +60,9 @@ public final class HttpProxyConfiguratio
 
     private BundleContext context;
 
-    private final Map<String, ServiceRegistration> registeredConfigurations = new LinkedHashMap<String, ServiceRegistration>();
+    private final Map<String, ServiceRegistration> registeredConfigurations = new LinkedHashMap<>();
 
-    private final List<CloseableHttpClient> trackedHttpClients = new LinkedList<CloseableHttpClient>();
+    private final List<CloseableHttpClient> trackedHttpClients = new LinkedList<>();
 
     /**
      * {@inheritDoc}
@@ -72,7 +72,7 @@ public final class HttpProxyConfiguratio
         this.context = context;
 
         // ensure we receive configurations for the proxy selector
-        final Hashtable<String, Object> props = new Hashtable<String, Object>();
+        final Hashtable<String, Object> props = new Hashtable<>();
         props.put(Constants.SERVICE_PID, getName());
         props.put(Constants.SERVICE_VENDOR, context.getBundle().getHeaders(Constants.BUNDLE_VENDOR));
         props.put(Constants.SERVICE_DESCRIPTION, SERVICE_FACTORY_NAME);

Modified: httpcomponents/httpclient/trunk/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/PropertiesUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/PropertiesUtils.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/PropertiesUtils.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/PropertiesUtils.java Sun May 24 14:24:26 2015
@@ -38,7 +38,7 @@ import java.util.Map;
 final class PropertiesUtils {
 
     private static final Map<Class<?>, PropertyConverter<?>> CONVERTERS_REGISTRY =
-                    new HashMap<Class<?>, PropertiesUtils.PropertyConverter<?>>();
+            new HashMap<>();
 
     static {
         register(new BooleanPropertyConverter(), boolean.class, Boolean.class);
@@ -147,7 +147,7 @@ final class PropertiesUtils {
             if (propValue.getClass().isArray()) {
                 // other array
                 final Object[] valueArray = (Object[]) propValue;
-                final List<String> values = new ArrayList<String>(valueArray.length);
+                final List<String> values = new ArrayList<>(valueArray.length);
                 for (final Object value : valueArray) {
                     if (value != null) {
                         values.add(value.toString());
@@ -160,7 +160,7 @@ final class PropertiesUtils {
             if (propValue instanceof Collection<?>) {
                 // collection
                 final Collection<?> valueCollection = (Collection<?>) propValue;
-                final List<String> valueList = new ArrayList<String>(valueCollection.size());
+                final List<String> valueList = new ArrayList<>(valueCollection.size());
                 for (final Object value : valueCollection) {
                     if (value != null) {
                         valueList.add(value.toString());

Modified: httpcomponents/httpclient/trunk/httpclient-win/src/test/java/org/apache/http/impl/auth/win/TestWindowsNegotiateScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-win/src/test/java/org/apache/http/impl/auth/win/TestWindowsNegotiateScheme.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-win/src/test/java/org/apache/http/impl/auth/win/TestWindowsNegotiateScheme.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-win/src/test/java/org/apache/http/impl/auth/win/TestWindowsNegotiateScheme.java Sun May 24 14:24:26 2015
@@ -112,11 +112,8 @@ public class TestWindowsNegotiateScheme
 
         final HttpHost target = start();
         final HttpGet httpGet = new HttpGet("/");
-        final CloseableHttpResponse response = customClient.execute(target, httpGet);
-        try {
+        try (CloseableHttpResponse response = customClient.execute(target, httpGet)) {
             EntityUtils.consume(response.getEntity());
-        } finally {
-            response.close();
         }
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAbortMethod.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAbortMethod.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAbortMethod.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAbortMethod.java Sun May 24 14:24:26 2015
@@ -38,23 +38,17 @@ import org.apache.http.impl.client.HttpC
 public class ClientAbortMethod {
 
     public final static void main(String[] args) throws Exception {
-        CloseableHttpClient httpclient = HttpClients.createDefault();
-        try {
+        try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
             HttpGet httpget = new HttpGet("http://www.apache.org/");
 
             System.out.println("Executing request " + httpget.getURI());
-            CloseableHttpResponse response = httpclient.execute(httpget);
-            try {
+            try (CloseableHttpResponse response = httpclient.execute(httpget)) {
                 System.out.println("----------------------------------------");
                 System.out.println(response.getStatusLine());
                 // Do not feel like reading the response body
                 // Call abort on the request object
                 httpget.abort();
-            } finally {
-                response.close();
             }
-        } finally {
-            httpclient.close();
         }
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAuthentication.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAuthentication.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAuthentication.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAuthentication.java Sun May 24 14:24:26 2015
@@ -47,23 +47,17 @@ public class ClientAuthentication {
         credsProvider.setCredentials(
                 new AuthScope("localhost", 443),
                 new UsernamePasswordCredentials("username", "password"));
-        CloseableHttpClient httpclient = HttpClients.custom()
+        try (CloseableHttpClient httpclient = HttpClients.custom()
                 .setDefaultCredentialsProvider(credsProvider)
-                .build();
-        try {
+                .build()) {
             HttpGet httpget = new HttpGet("http://localhost/");
 
             System.out.println("Executing request " + httpget.getRequestLine());
-            CloseableHttpResponse response = httpclient.execute(httpget);
-            try {
+            try (CloseableHttpResponse response = httpclient.execute(httpget)) {
                 System.out.println("----------------------------------------");
                 System.out.println(response.getStatusLine());
                 EntityUtils.consume(response.getEntity());
-            } finally {
-                response.close();
             }
-        } finally {
-            httpclient.close();
         }
     }
 }



Mime
View raw message