hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1681461 [3/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
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/LaxExpiresHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/LaxExpiresHandler.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/LaxExpiresHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/LaxExpiresHandler.java Sun May 24 14:24:26 2015
@@ -72,7 +72,7 @@ public class LaxExpiresHandler extends A
     }
     private static final Map<String, Integer> MONTHS;
     static {
-        final ConcurrentHashMap<String, Integer> map = new ConcurrentHashMap<String, Integer>(12);
+        final ConcurrentHashMap<String, Integer> map = new ConcurrentHashMap<>(12);
         map.put("jan", Calendar.JANUARY);
         map.put("feb", Calendar.FEBRUARY);
         map.put("mar", Calendar.MARCH);

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftHeaderParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftHeaderParser.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftHeaderParser.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftHeaderParser.java Sun May 24 14:24:26 2015
@@ -71,7 +71,7 @@ public class NetscapeDraftHeaderParser {
         Args.notNull(buffer, "Char array buffer");
         Args.notNull(cursor, "Parser cursor");
         final NameValuePair nvp = parseNameValuePair(buffer, cursor);
-        final List<NameValuePair> params = new ArrayList<NameValuePair>();
+        final List<NameValuePair> params = new ArrayList<>();
         while (!cursor.atEnd()) {
             final NameValuePair param = parseNameValuePair(buffer, cursor);
             params.add(param);

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpec.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpec.java Sun May 24 14:24:26 2015
@@ -151,7 +151,7 @@ public class NetscapeDraftSpec extends C
                 buffer.append(s);
             }
         }
-        final List<Header> headers = new ArrayList<Header>(1);
+        final List<Header> headers = new ArrayList<>(1);
         headers.add(new BufferedHeader(buffer));
         return headers;
     }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java Sun May 24 14:24:26 2015
@@ -125,7 +125,7 @@ public class RFC2109Spec extends CookieS
         List<Cookie> cookieList;
         if (cookies.size() > 1) {
             // Create a mutable copy and sort the copy.
-            cookieList = new ArrayList<Cookie>(cookies);
+            cookieList = new ArrayList<>(cookies);
             Collections.sort(cookieList, CookiePathComparator.INSTANCE);
         } else {
             cookieList = cookies;
@@ -155,13 +155,13 @@ public class RFC2109Spec extends CookieS
             final Cookie cookie = cooky;
             formatCookieAsVer(buffer, cookie, version);
         }
-        final List<Header> headers = new ArrayList<Header>(1);
+        final List<Header> headers = new ArrayList<>(1);
         headers.add(new BufferedHeader(buffer));
         return headers;
     }
 
     private List<Header> doFormatManyHeaders(final List<Cookie> cookies) {
-        final List<Header> headers = new ArrayList<Header>(cookies.size());
+        final List<Header> headers = new ArrayList<>(cookies.size());
         for (final Cookie cookie : cookies) {
             final int version = cookie.getVersion();
             final CharArrayBuffer buffer = new CharArrayBuffer(40);

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java Sun May 24 14:24:26 2015
@@ -112,7 +112,7 @@ public class RFC2965Spec extends RFC2109
     private List<Cookie> createCookies(
             final HeaderElement[] elems,
             final CookieOrigin origin) throws MalformedCookieException {
-        final List<Cookie> cookies = new ArrayList<Cookie>(elems.length);
+        final List<Cookie> cookies = new ArrayList<>(elems.length);
         for (final HeaderElement headerelement : elems) {
             final String name = headerelement.getName();
             final String value = headerelement.getValue();
@@ -130,7 +130,7 @@ public class RFC2965Spec extends RFC2109
             // Eliminate duplicate attributes. The first occurrence takes precedence
             // See RFC2965: 3.2  Origin Server Role
             final Map<String, NameValuePair> attribmap =
-                    new HashMap<String, NameValuePair>(attribs.length);
+                    new HashMap<>(attribs.length);
             for (int j = attribs.length - 1; j >= 0; j--) {
                 final NameValuePair param = attribs[j];
                 attribmap.put(param.getName().toLowerCase(Locale.ROOT), param);

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265CookieSpec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265CookieSpec.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265CookieSpec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC6265CookieSpec.java Sun May 24 14:24:26 2015
@@ -83,7 +83,7 @@ public class RFC6265CookieSpec implement
     protected RFC6265CookieSpec(final CommonCookieAttributeHandler... handlers) {
         super();
         this.attribHandlers = handlers.clone();
-        this.attribHandlerMap = new ConcurrentHashMap<String, CookieAttributeHandler>(handlers.length);
+        this.attribHandlerMap = new ConcurrentHashMap<>(handlers.length);
         for (CommonCookieAttributeHandler handler: handlers) {
             this.attribHandlerMap.put(handler.getAttributeName().toLowerCase(Locale.ROOT), handler);
         }
@@ -149,7 +149,7 @@ public class RFC6265CookieSpec implement
         cookie.setDomain(getDefaultDomain(origin));
         cookie.setCreationDate(new Date());
 
-        final Map<String, String> attribMap = new LinkedHashMap<String, String>();
+        final Map<String, String> attribMap = new LinkedHashMap<>();
         while (!cursor.atEnd()) {
             final String paramName = tokenParser.parseToken(buffer, cursor, TOKEN_DELIMS)
                     .toLowerCase(Locale.ROOT);
@@ -212,7 +212,7 @@ public class RFC6265CookieSpec implement
         final List<? extends Cookie> sortedCookies;
         if (cookies.size() > 1) {
             // Create a mutable copy and sort the copy.
-            sortedCookies = new ArrayList<Cookie>(cookies);
+            sortedCookies = new ArrayList<>(cookies);
             Collections.sort(sortedCookies, CookiePriorityComparator.INSTANCE);
         } else {
             sortedCookies = cookies;
@@ -245,7 +245,7 @@ public class RFC6265CookieSpec implement
                 }
             }
         }
-        final List<Header> headers = new ArrayList<Header>(1);
+        final List<Header> headers = new ArrayList<>(1);
         headers.add(new BufferedHeader(buffer));
         return headers;
     }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java Sun May 24 14:24:26 2015
@@ -333,13 +333,7 @@ public class MainClientExec implements C
                     "Connection has been shut down");
             ioex.initCause(ex);
             throw ioex;
-        } catch (final HttpException ex) {
-            connHolder.abortConnection();
-            throw ex;
-        } catch (final IOException ex) {
-            connHolder.abortConnection();
-            throw ex;
-        } catch (final RuntimeException ex) {
+        } catch (final HttpException | RuntimeException | IOException ex) {
             connHolder.abortConnection();
             throw ex;
         }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java Sun May 24 14:24:26 2015
@@ -237,13 +237,7 @@ public class MinimalClientExec implement
                     "Connection has been shut down");
             ioex.initCause(ex);
             throw ioex;
-        } catch (final HttpException ex) {
-            releaseTrigger.abortConnection();
-            throw ex;
-        } catch (final IOException ex) {
-            releaseTrigger.abortConnection();
-            throw ex;
-        } catch (final RuntimeException ex) {
+        } catch (final HttpException | RuntimeException | IOException ex) {
             releaseTrigger.abortConnection();
             throw ex;
         }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java Sun May 24 14:24:26 2015
@@ -167,13 +167,7 @@ public class ProtocolExec implements Cli
             context.setAttribute(HttpCoreContext.HTTP_RESPONSE, response);
             this.httpProcessor.process(response, context);
             return response;
-        } catch (final RuntimeException ex) {
-            response.close();
-            throw ex;
-        } catch (final IOException ex) {
-            response.close();
-            throw ex;
-        } catch (final HttpException ex) {
+        } catch (final RuntimeException | HttpException | IOException ex) {
             response.close();
             throw ex;
         }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/RedirectExec.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/RedirectExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/RedirectExec.java Sun May 24 14:24:26 2015
@@ -163,10 +163,7 @@ public class RedirectExec implements Cli
                 } else {
                     return response;
                 }
-            } catch (final RuntimeException ex) {
-                response.close();
-                throw ex;
-            } catch (final IOException ex) {
+            } catch (final RuntimeException | IOException ex) {
                 response.close();
                 throw ex;
             } catch (final HttpException ex) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestDefaultHeaders.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestDefaultHeaders.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestDefaultHeaders.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestDefaultHeaders.java Sun May 24 14:24:26 2015
@@ -51,7 +51,7 @@ public class TestRequestDefaultHeaders {
     @Test
     public void testNoDefaultHeadersForConnectRequest() throws Exception {
         final HttpRequest request = new BasicHttpRequest("CONNECT", "www.somedomain.com");
-        final List<Header> defheaders = new ArrayList<Header>();
+        final List<Header> defheaders = new ArrayList<>();
         defheaders.add(new BasicHeader("custom", "stuff"));
         final HttpContext context = new BasicHttpContext();
 
@@ -65,7 +65,7 @@ public class TestRequestDefaultHeaders {
     public void testDefaultHeaders() throws Exception {
         final HttpRequest request = new BasicHttpRequest("GET", "/");
         request.addHeader("custom", "stuff");
-        final List<Header> defheaders = new ArrayList<Header>();
+        final List<Header> defheaders = new ArrayList<>();
         defheaders.add(new BasicHeader("custom", "more stuff"));
         final HttpContext context = new BasicHttpContext();
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURIBuilder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURIBuilder.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURIBuilder.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURIBuilder.java Sun May 24 14:24:26 2015
@@ -285,7 +285,7 @@ public class TestURIBuilder {
     }
 
     private List<NameValuePair> createParameters() {
-        final List<NameValuePair> parameters = new ArrayList<NameValuePair>();
+        final List<NameValuePair> parameters = new ArrayList<>();
         parameters.add(new BasicNameValuePair("parameter1", "value1"));
         parameters.add(new BasicNameValuePair("parameter2", "\"1\u00aa position\""));
         parameters.add(new BasicNameValuePair("parameter3", "Jos\u00e9 Abra\u00e3o"));

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURLEncodedUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURLEncodedUtils.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURLEncodedUtils.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURLEncodedUtils.java Sun May 24 14:24:26 2015
@@ -205,7 +205,7 @@ public class TestURLEncodedUtils {
     public void testParseUTF8Entity() throws Exception {
         final String ru_hello = constructString(RUSSIAN_HELLO);
         final String ch_hello = constructString(SWISS_GERMAN_HELLO);
-        final List <NameValuePair> parameters = new ArrayList<NameValuePair>();
+        final List <NameValuePair> parameters = new ArrayList<>();
         parameters.add(new BasicNameValuePair("russian", ru_hello));
         parameters.add(new BasicNameValuePair("swiss", ch_hello));
 
@@ -226,7 +226,7 @@ public class TestURLEncodedUtils {
     public void testParseUTF8Ampersand1String() throws Exception {
         final String ru_hello = constructString(RUSSIAN_HELLO);
         final String ch_hello = constructString(SWISS_GERMAN_HELLO);
-        final List <NameValuePair> parameters = new ArrayList<NameValuePair>();
+        final List <NameValuePair> parameters = new ArrayList<>();
         parameters.add(new BasicNameValuePair("russian", ru_hello));
         parameters.add(new BasicNameValuePair("swiss", ch_hello));
 
@@ -251,7 +251,7 @@ public class TestURLEncodedUtils {
     private void testParseUTF8String(final char parameterSeparator) throws Exception {
         final String ru_hello = constructString(RUSSIAN_HELLO);
         final String ch_hello = constructString(SWISS_GERMAN_HELLO);
-        final List <NameValuePair> parameters = new ArrayList<NameValuePair>();
+        final List <NameValuePair> parameters = new ArrayList<>();
         parameters.add(new BasicNameValuePair("russian", ru_hello));
         parameters.add(new BasicNameValuePair("swiss", ch_hello));
 
@@ -270,7 +270,7 @@ public class TestURLEncodedUtils {
     public void testParseEntityDefaultContentType() throws Exception {
         final String ch_hello = constructString(SWISS_GERMAN_HELLO);
         final String us_hello = "hi there";
-        final List <NameValuePair> parameters = new ArrayList<NameValuePair>();
+        final List <NameValuePair> parameters = new ArrayList<>();
         parameters.add(new BasicNameValuePair("english", us_hello));
         parameters.add(new BasicNameValuePair("swiss", ch_hello));
 
@@ -302,7 +302,7 @@ public class TestURLEncodedUtils {
 
     @Test
     public void testFormat() throws Exception {
-        final List <NameValuePair> params = new ArrayList <NameValuePair>();
+        final List <NameValuePair> params = new ArrayList<>();
         Assert.assertEquals(0, URLEncodedUtils.format(params, Consts.ASCII).length());
 
         params.clear();
@@ -349,7 +349,7 @@ public class TestURLEncodedUtils {
 
     @Test
     public void testFormatString() throws Exception { // as above, using String
-        final List <NameValuePair> params = new ArrayList <NameValuePair>();
+        final List <NameValuePair> params = new ArrayList<>();
         Assert.assertEquals(0, URLEncodedUtils.format(params, "US-ASCII").length());
 
         params.clear();

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/routing/TestHttpRoute.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/routing/TestHttpRoute.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/routing/TestHttpRoute.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/routing/TestHttpRoute.java Sun May 24 14:24:26 2015
@@ -186,7 +186,7 @@ public class TestHttpRoute {
         Assert.assertTrue ("routettt.layer" , routettt.isLayered());
 
 
-        final Set<HttpRoute> routes = new HashSet<HttpRoute>();
+        final Set<HttpRoute> routes = new HashSet<>();
         routes.add(routefff);
         routes.add(routefft);
         routes.add(routeftf);
@@ -199,7 +199,7 @@ public class TestHttpRoute {
 
         // we can't test hashCode in general due to its dependency
         // on InetAddress and HttpHost, but we can check for the flags
-        final Set<Integer> routecodes = new HashSet<Integer>();
+        final Set<Integer> routecodes = new HashSet<>();
         routecodes.add(Integer.valueOf(routefff.hashCode()));
         routecodes.add(Integer.valueOf(routefft.hashCode()));
         routecodes.add(Integer.valueOf(routeftf.hashCode()));
@@ -211,7 +211,7 @@ public class TestHttpRoute {
         Assert.assertEquals("some flagged routes have same hashCode",
                      8, routecodes.size());
 
-        final Set<String> routestrings = new HashSet<String>();
+        final Set<String> routestrings = new HashSet<>();
         routestrings.add(routefff.toString());
         routestrings.add(routefft.toString());
         routestrings.add(routeftf.toString());
@@ -377,7 +377,7 @@ public class TestHttpRoute {
 
         // now check that all of the routes are different from eachother
         // except for those that aren't :-)
-        final Set<HttpRoute> routes = new HashSet<HttpRoute>();
+        final Set<HttpRoute> routes = new HashSet<>();
         routes.add(route1a);
         routes.add(route2a);
         routes.add(route2b);
@@ -402,7 +402,7 @@ public class TestHttpRoute {
         }
 
         // and don't forget toString
-        final Set<String> routestrings = new HashSet<String>();
+        final Set<String> routestrings = new HashSet<>();
         routestrings.add(route1a.toString());
         routestrings.add(route2a.toString());
         routestrings.add(route2b.toString());

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/routing/TestRouteTracker.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/routing/TestRouteTracker.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/routing/TestRouteTracker.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/routing/TestRouteTracker.java Sun May 24 14:24:26 2015
@@ -420,14 +420,14 @@ public class TestRouteTracker {
         // rt0 -> direct connection
         // rt1 -> via single proxy
         // rt2 -> via proxy chain
-        final Set<RouteTracker> hs = new HashSet<RouteTracker>();
+        final Set<RouteTracker> hs = new HashSet<>();
 
         // we also collect hashcodes for the different paths
         // since we can't guarantee what influence the HttpHost hashcodes have,
         // we keep separate sets here
-        final Set<Integer> hc0 = new HashSet<Integer>();
-        final Set<Integer> hc4 = new HashSet<Integer>();
-        final Set<Integer> hc6 = new HashSet<Integer>();
+        final Set<Integer> hc0 = new HashSet<>();
+        final Set<Integer> hc4 = new HashSet<>();
+        final Set<Integer> hc6 = new HashSet<>();
 
         RouteTracker rt = null;
 
@@ -548,7 +548,7 @@ public class TestRouteTracker {
 
 
         // check that all toString are OK and different
-        final Set<String> rtstrings = new HashSet<String>();
+        final Set<String> rtstrings = new HashSet<>();
         for (final RouteTracker current: hs) {
             final String rts = checkToString(current);
             Assert.assertTrue("duplicate toString: " + rts, rtstrings.add(rts));

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java Sun May 24 14:24:26 2015
@@ -99,14 +99,11 @@ public class TestSSLSocketFactory {
         final Socket socket = socketFactory.createSocket(context);
         final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
         final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
-        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target, remoteAddress, null, context);
-        try {
+        try (SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target, remoteAddress, null, context)) {
             final SSLSession sslsession = sslSocket.getSession();
 
             Assert.assertNotNull(sslsession);
             Assert.assertTrue(hostVerifier.isFired());
-        } finally {
-            sslSocket.close();
         }
     }
 
@@ -124,13 +121,10 @@ public class TestSSLSocketFactory {
         final Socket socket = socketFactory.createSocket(context);
         final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
         final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
-        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target, remoteAddress, null, context);
-        try {
+        try (SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target, remoteAddress, null, context)) {
             final SSLSession sslsession = sslSocket.getSession();
 
             Assert.assertNotNull(sslsession);
-        } finally {
-            sslSocket.close();
         }
     }
 
@@ -149,14 +143,11 @@ public class TestSSLSocketFactory {
         final Socket socket = socketFactory.createSocket(context);
         final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
         final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
-        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target, remoteAddress, null, context);
-        try {
+        try (SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target, remoteAddress, null, context)) {
             final SSLSession sslsession = sslSocket.getSession();
 
             Assert.assertNotNull(sslsession);
             Assert.assertTrue(hostVerifier.isFired());
-        } finally {
-            sslSocket.close();
         }
     }
 
@@ -183,14 +174,11 @@ public class TestSSLSocketFactory {
         final Socket socket = socketFactory.createSocket(context);
         final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
         final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
-        final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target, remoteAddress, null, context);
-        try {
+        try (SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(0, socket, target, remoteAddress, null, context)) {
             final SSLSession sslsession = sslSocket.getSession();
 
             Assert.assertNotNull(sslsession);
             Assert.assertTrue(hostVerifier.isFired());
-        } finally {
-            sslSocket.close();
         }
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestDigestScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestDigestScheme.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestDigestScheme.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestDigestScheme.java Sun May 24 14:24:26 2015
@@ -423,7 +423,7 @@ public class TestDigestScheme {
             return null;
         }
         final HeaderElement[] elements = BasicHeaderValueParser.parseElements(s.substring(7), null);
-        final Map<String, String> map = new HashMap<String, String>(elements.length);
+        final Map<String, String> map = new HashMap<>(elements.length);
         for (final HeaderElement element : elements) {
             map.put(element.getName(), element.getValue());
         }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestHttpAuthenticator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestHttpAuthenticator.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestHttpAuthenticator.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestHttpAuthenticator.java Sun May 24 14:24:26 2015
@@ -409,7 +409,7 @@ public class TestHttpAuthenticator {
     public void testAuthChallengeStateOneOptions() throws Exception {
         final HttpRequest request = new BasicHttpRequest("GET", "/");
         this.authState.setState(AuthProtocolState.CHALLENGED);
-        final LinkedList<AuthOption> authOptions = new LinkedList<AuthOption>();
+        final LinkedList<AuthOption> authOptions = new LinkedList<>();
         authOptions.add(new AuthOption(this.authScheme, this.credentials));
         this.authState.update(authOptions);
 
@@ -434,7 +434,7 @@ public class TestHttpAuthenticator {
         final HttpRequest request = new BasicHttpRequest("GET", "/");
         this.authState.setState(AuthProtocolState.CHALLENGED);
 
-        final LinkedList<AuthOption> authOptions = new LinkedList<AuthOption>();
+        final LinkedList<AuthOption> authOptions = new LinkedList<>();
         final AuthScheme authScheme1 = Mockito.mock(AuthScheme.class);
         Mockito.doThrow(new AuthenticationException()).when(authScheme1).authenticate(
                 Mockito.any(Credentials.class),

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/MockConnPoolControl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/MockConnPoolControl.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/MockConnPoolControl.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/MockConnPoolControl.java Sun May 24 14:24:26 2015
@@ -42,7 +42,7 @@ public final class MockConnPoolControl i
 
     public MockConnPoolControl() {
         super();
-        this.maxPerHostMap = new ConcurrentHashMap<HttpRoute, Integer>();
+        this.maxPerHostMap = new ConcurrentHashMap<>();
         this.totalMax = 20;
         this.defaultMax = 2;
     }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAuthenticationStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAuthenticationStrategy.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAuthenticationStrategy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAuthenticationStrategy.java Sun May 24 14:24:26 2015
@@ -124,7 +124,7 @@ public class TestAuthenticationStrategy
     @Test
     public void testSelectInvalidInput() throws Exception {
         final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
-        final Map<String, Header> challenges = new HashMap<String, Header>();
+        final Map<String, Header> challenges = new HashMap<>();
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_UNAUTHORIZED, "UNAUTHORIZED");
         final HttpHost authhost = new HttpHost("locahost", 80);
         final HttpClientContext context = HttpClientContext.create();
@@ -157,7 +157,7 @@ public class TestAuthenticationStrategy
         final HttpHost authhost = new HttpHost("locahost", 80);
         final HttpClientContext context = HttpClientContext.create();
 
-        final Map<String, Header> challenges = new HashMap<String, Header>();
+        final Map<String, Header> challenges = new HashMap<>();
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=\"test\""));
         challenges.put("digest", new BasicHeader(AUTH.WWW_AUTH, "Digest realm=\"realm1\", nonce=\"1234\""));
 
@@ -173,7 +173,7 @@ public class TestAuthenticationStrategy
         final HttpHost authhost = new HttpHost("locahost", 80);
         final HttpClientContext context = HttpClientContext.create();
 
-        final Map<String, Header> challenges = new HashMap<String, Header>();
+        final Map<String, Header> challenges = new HashMap<>();
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=\"test\""));
         challenges.put("digest", new BasicHeader(AUTH.WWW_AUTH, "Digest realm=\"realm1\", nonce=\"1234\""));
 
@@ -194,7 +194,7 @@ public class TestAuthenticationStrategy
         final HttpHost authhost = new HttpHost("locahost", 80);
         final HttpClientContext context = HttpClientContext.create();
 
-        final Map<String, Header> challenges = new HashMap<String, Header>();
+        final Map<String, Header> challenges = new HashMap<>();
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=\"realm1\""));
         challenges.put("digest", new BasicHeader(AUTH.WWW_AUTH, "Digest realm=\"realm2\", nonce=\"1234\""));
 
@@ -218,7 +218,7 @@ public class TestAuthenticationStrategy
         final HttpHost authhost = new HttpHost("somehost", 80);
         final HttpClientContext context = HttpClientContext.create();
 
-        final Map<String, Header> challenges = new HashMap<String, Header>();
+        final Map<String, Header> challenges = new HashMap<>();
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=\"realm1\""));
         challenges.put("digest", new BasicHeader(AUTH.WWW_AUTH, "Digest realm=\"realm2\", nonce=\"1234\""));
 
@@ -246,7 +246,7 @@ public class TestAuthenticationStrategy
         final HttpHost authhost = new HttpHost("somehost", 80);
         final HttpClientContext context = HttpClientContext.create();
 
-        final Map<String, Header> challenges = new HashMap<String, Header>();
+        final Map<String, Header> challenges = new HashMap<>();
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=\"realm1\""));
         challenges.put("digest", new BasicHeader(AUTH.WWW_AUTH, "Digest realm=\"realm2\", nonce=\"1234\""));
         challenges.put("whatever", new BasicHeader(AUTH.WWW_AUTH, "Whatever realm=\"realm3\""));
@@ -281,7 +281,7 @@ public class TestAuthenticationStrategy
         final HttpHost authhost = new HttpHost("somehost", 80);
         final HttpClientContext context = HttpClientContext.create();
 
-        final Map<String, Header> challenges = new HashMap<String, Header>();
+        final Map<String, Header> challenges = new HashMap<>();
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=\"realm1\""));
         challenges.put("digest", new BasicHeader(AUTH.WWW_AUTH, "Digest realm=\"realm2\", nonce=\"1234\""));
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestFutureRequestExecutionService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestFutureRequestExecutionService.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestFutureRequestExecutionService.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestFutureRequestExecutionService.java Sun May 24 14:24:26 2015
@@ -128,7 +128,7 @@ public class TestFutureRequestExecutionS
     @Test
     public void shouldExecuteMultipleCalls() throws Exception {
         final int reqNo = 100;
-        final Queue<Future<Boolean>> tasks = new LinkedList<Future<Boolean>>();
+        final Queue<Future<Boolean>> tasks = new LinkedList<>();
         for(int i = 0; i < reqNo; i++) {
             final Future<Boolean> task = httpAsyncClientWithFuture.execute(
                     new HttpGet(uri), HttpClientContext.create(), new OkidokiHandler());
@@ -144,7 +144,7 @@ public class TestFutureRequestExecutionS
     @Test
     public void shouldExecuteMultipleCallsAndCallback() throws Exception {
         final int reqNo = 100;
-        final Queue<Future<Boolean>> tasks = new LinkedList<Future<Boolean>>();
+        final Queue<Future<Boolean>> tasks = new LinkedList<>();
         final CountDownLatch latch = new CountDownLatch(reqNo);
         for(int i = 0; i < reqNo; i++) {
             final Future<Boolean> task = httpAsyncClientWithFuture.execute(

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java Sun May 24 14:24:26 2015
@@ -106,8 +106,7 @@ public class TestAbortHandling extends L
         final HttpClientContext context = HttpClientContext.create();
         try {
             this.httpclient.execute(target, httpget, context);
-        } catch (final IllegalStateException e) {
-        } catch (final IOException e) {
+        } catch (final IllegalStateException | IOException e) {
         }
 
         final HttpRequest reqWrapper = context.getRequest();
@@ -119,7 +118,7 @@ public class TestAbortHandling extends L
         final CountDownLatch connLatch = new CountDownLatch(1);
         final CountDownLatch awaitLatch = new CountDownLatch(1);
         final ConMan conMan = new ConMan(connLatch, awaitLatch);
-        final AtomicReference<Throwable> throwableRef = new AtomicReference<Throwable>();
+        final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
         final CountDownLatch getLatch = new CountDownLatch(1);
         this.clientBuilder.setConnectionManager(conMan);
         final HttpContext context = new BasicHttpContext();
@@ -160,7 +159,7 @@ public class TestAbortHandling extends L
         this.serverBootstrap.registerHandler("*", new BasicService());
 
         final CountDownLatch releaseLatch = new CountDownLatch(1);
-        final AtomicReference<Throwable> throwableRef = new AtomicReference<Throwable>();
+        final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
         final CountDownLatch getLatch = new CountDownLatch(1);
         final HttpContext context = new BasicHttpContext();
         final HttpGet httpget = new CustomGet("a", releaseLatch);
@@ -199,7 +198,7 @@ public class TestAbortHandling extends L
     public void testAbortBeforeExecute() throws Exception {
         this.serverBootstrap.registerHandler("*", new BasicService());
 
-        final AtomicReference<Throwable> throwableRef = new AtomicReference<Throwable>();
+        final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
         final CountDownLatch getLatch = new CountDownLatch(1);
         final CountDownLatch startLatch = new CountDownLatch(1);
         final HttpContext context = new BasicHttpContext();
@@ -248,7 +247,7 @@ public class TestAbortHandling extends L
         final CountDownLatch connLatch = new CountDownLatch(1);
         final CountDownLatch awaitLatch = new CountDownLatch(1);
         final ConnMan4 conMan = new ConnMan4(connLatch, awaitLatch);
-        final AtomicReference<Throwable> throwableRef = new AtomicReference<Throwable>();
+        final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
         final CountDownLatch getLatch = new CountDownLatch(1);
         this.clientBuilder.setConnectionManager(conMan);
         final HttpContext context = new BasicHttpContext();

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestBasicConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestBasicConnectionManager.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestBasicConnectionManager.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestBasicConnectionManager.java Sun May 24 14:24:26 2015
@@ -43,12 +43,9 @@ public class TestBasicConnectionManager
 
         final HttpHost target = start();
         final HttpGet get = new HttpGet("/random/1024");
-        final CloseableHttpResponse response = this.httpclient.execute(target, get);
-        try {
+        try (CloseableHttpResponse response = this.httpclient.execute(target, get)) {
             Assert.assertEquals(200, response.getStatusLine().getStatusCode());
             EntityUtils.consume(response.getEntity());
-        } finally {
-            response.close();
         }
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java Sun May 24 14:24:26 2015
@@ -453,7 +453,7 @@ public class TestConnectionManagement ex
 
         final HttpClientConnection conn = getConnection(this.connManager, route);
 
-        final AtomicReference<Throwable> throwRef = new AtomicReference<Throwable>();
+        final AtomicReference<Throwable> throwRef = new AtomicReference<>();
         final Thread abortingThread = new Thread(new Runnable() {
             @Override
             public void run() {
@@ -510,7 +510,7 @@ public class TestConnectionManagement ex
 
         final HttpClientConnection conn = getConnection(this.connManager, route);
 
-        final AtomicReference<Throwable> throwRef = new AtomicReference<Throwable>();
+        final AtomicReference<Throwable> throwRef = new AtomicReference<>();
         final Thread abortingThread = new Thread(new Runnable() {
             @Override
             public void run() {
@@ -568,7 +568,7 @@ public class TestConnectionManagement ex
 
         final HttpClientConnection conn = getConnection(this.connManager, route);
 
-        final AtomicReference<Throwable> throwRef = new AtomicReference<Throwable>();
+        final AtomicReference<Throwable> throwRef = new AtomicReference<>();
         final Thread abortingThread = new Thread(new Runnable() {
             @Override
             public void run() {

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestContentCodings.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestContentCodings.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestContentCodings.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestContentCodings.java Sun May 24 14:24:26 2015
@@ -183,7 +183,7 @@ public class TestContentCodings extends
         final CountDownLatch startGate = new CountDownLatch(1);
         final CountDownLatch endGate = new CountDownLatch(clients);
 
-        final List<WorkerTask> workers = new ArrayList<WorkerTask>();
+        final List<WorkerTask> workers = new ArrayList<>();
 
         for (int i = 0; i < clients; ++i) {
             workers.add(new WorkerTask(this.httpclient, target, i % 2 == 0, startGate, endGate));

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookieVirtualHost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookieVirtualHost.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookieVirtualHost.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookieVirtualHost.java Sun May 24 14:24:26 2015
@@ -117,11 +117,8 @@ public class TestCookieVirtualHost exten
         URI uri = new URI("http://app.mydomain.fr");
         HttpRequest httpRequest = new HttpGet(uri);
         httpRequest.addHeader("X-Request", "1");
-        final CloseableHttpResponse response1 = this.httpclient.execute(target, httpRequest, context);
-        try {
+        try (CloseableHttpResponse response1 = this.httpclient.execute(target, httpRequest, context)) {
             EntityUtils.consume(response1.getEntity());
-        } finally {
-            response1.close();
         }
 
         // We should have one cookie set on domain.
@@ -134,22 +131,16 @@ public class TestCookieVirtualHost exten
         uri = new URI("http://app.mydomain.fr");
         httpRequest = new HttpGet(uri);
         httpRequest.addHeader("X-Request", "2");
-        final CloseableHttpResponse response2 = this.httpclient.execute(target, httpRequest, context);
-        try {
+        try (CloseableHttpResponse response2 = this.httpclient.execute(target, httpRequest, context)) {
             EntityUtils.consume(response2.getEntity());
-        } finally {
-            response2.close();
         }
 
         // Third request : Host header
         uri = new URI("http://app.mydomain.fr");
         httpRequest = new HttpGet(uri);
         httpRequest.addHeader("X-Request", "3");
-        final CloseableHttpResponse response3 = this.httpclient.execute(target, httpRequest, context);
-        try {
+        try (CloseableHttpResponse response3 = this.httpclient.execute(target, httpRequest, context)) {
             EntityUtils.consume(response3.getEntity());
-        } finally {
-            response3.close();
         }
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestMalformedServerResponse.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestMalformedServerResponse.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestMalformedServerResponse.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestMalformedServerResponse.java Sun May 24 14:24:26 2015
@@ -112,20 +112,14 @@ public class TestMalformedServerResponse
 
         final HttpHost target = start();
         final HttpGet get1 = new HttpGet("/nostuff");
-        final CloseableHttpResponse response1 = this.httpclient.execute(target, get1);
-        try {
+        try (CloseableHttpResponse response1 = this.httpclient.execute(target, get1)) {
             Assert.assertEquals(HttpStatus.SC_NO_CONTENT, response1.getStatusLine().getStatusCode());
             EntityUtils.consume(response1.getEntity());
-        } finally {
-            response1.close();
         }
         final HttpGet get2 = new HttpGet("/stuff");
-        final CloseableHttpResponse response2 = this.httpclient.execute(target, get2);
-        try {
+        try (CloseableHttpResponse response2 = this.httpclient.execute(target, get2)) {
             Assert.assertEquals(HttpStatus.SC_OK, response2.getStatusLine().getStatusCode());
             EntityUtils.consume(response2.getEntity());
-        } finally {
-            response2.close();
         }
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestMinimalClientRequestExecution.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestMinimalClientRequestExecution.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestMinimalClientRequestExecution.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestMinimalClientRequestExecution.java Sun May 24 14:24:26 2015
@@ -87,7 +87,7 @@ public class TestMinimalClientRequestExe
             Assert.assertNotNull(reqWrapper);
 
             final Header[] headers = reqWrapper.getAllHeaders();
-            final Set<String> headerSet = new HashSet<String>();
+            final Set<String> headerSet = new HashSet<>();
             for (final Header header: headers) {
                 headerSet.add(header.getName().toLowerCase(Locale.ROOT));
             }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestSystemDefaultRoutePlanner.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestSystemDefaultRoutePlanner.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestSystemDefaultRoutePlanner.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestSystemDefaultRoutePlanner.java Sun May 24 14:24:26 2015
@@ -103,7 +103,7 @@ public class TestSystemDefaultRoutePlann
         final InetSocketAddress isa1 = new InetSocketAddress(ia, 11111);
         final InetSocketAddress isa2 = new InetSocketAddress(ia, 22222);
 
-        final List<Proxy> proxies = new ArrayList<Proxy>(2);
+        final List<Proxy> proxies = new ArrayList<>(2);
         proxies.add(new Proxy(Proxy.Type.HTTP, isa1));
         proxies.add(new Proxy(Proxy.Type.HTTP, isa2));
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieNetscapeDraft.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieNetscapeDraft.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieNetscapeDraft.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieNetscapeDraft.java Sun May 24 14:24:26 2015
@@ -271,7 +271,7 @@ public class TestCookieNetscapeDraft {
         final Cookie c3 = new BasicClientCookie("name3", null);
 
         final CookieSpec cookiespec = new NetscapeDraftSpec();
-        final List<Cookie> cookies = new ArrayList<Cookie>();
+        final List<Cookie> cookies = new ArrayList<>();
         cookies.add(c1);
         cookies.add(c2);
         cookies.add(c3);
@@ -303,7 +303,7 @@ public class TestCookieNetscapeDraft {
             // expected
         }
         try {
-            final List<Cookie> cookies = new ArrayList<Cookie>();
+            final List<Cookie> cookies = new ArrayList<>();
             cookiespec.formatCookies(cookies);
             Assert.fail("IllegalArgumentException must have been thrown");
         } catch (final IllegalArgumentException ex) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2109Spec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2109Spec.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2109Spec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2109Spec.java Sun May 24 14:24:26 2015
@@ -367,7 +367,7 @@ public class TestCookieRFC2109Spec {
         cookie.setAttribute(ClientCookie.PATH_ATTR, cookie.getPath());
 
         final CookieSpec cookiespec = new RFC2109Spec();
-        List<Cookie> cookies = new ArrayList<Cookie>();
+        List<Cookie> cookies = new ArrayList<>();
         cookies.add(cookie);
         List<Header> headers = cookiespec.formatCookies(cookies);
         Assert.assertNotNull(headers);
@@ -376,7 +376,7 @@ public class TestCookieRFC2109Spec {
                 headers.get(0).getValue());
 
         cookie.setVersion(1);
-        cookies = new ArrayList<Cookie>();
+        cookies = new ArrayList<>();
         cookies.add(cookie);
         headers = cookiespec.formatCookies(cookies);
         Assert.assertNotNull(headers);
@@ -392,7 +392,7 @@ public class TestCookieRFC2109Spec {
         cookie.setAttribute(ClientCookie.PATH_ATTR, cookie.getPath());
 
         final CookieSpec cookiespec = new RFC2109Spec();
-        List<Cookie> cookies = new ArrayList<Cookie>();
+        List<Cookie> cookies = new ArrayList<>();
         cookies.add(cookie);
         List<Header> headers = cookiespec.formatCookies(cookies);
         Assert.assertNotNull(headers);
@@ -401,7 +401,7 @@ public class TestCookieRFC2109Spec {
 
         cookie.removeAttribute(ClientCookie.DOMAIN_ATTR);
         cookie.removeAttribute(ClientCookie.PATH_ATTR);
-        cookies = new ArrayList<Cookie>();
+        cookies = new ArrayList<>();
         cookies.add(cookie);
         headers = cookiespec.formatCookies(cookies);
         Assert.assertNotNull(headers);
@@ -425,7 +425,7 @@ public class TestCookieRFC2109Spec {
         c4.setAttribute(ClientCookie.PATH_ATTR, c4.getPath());
 
         final CookieSpec cookiespec = new RFC2109Spec(null, true);
-        final List<Cookie> cookies = new ArrayList<Cookie>();
+        final List<Cookie> cookies = new ArrayList<>();
         cookies.add(c2);
         cookies.add(c4);
         cookies.add(c1);
@@ -477,7 +477,7 @@ public class TestCookieRFC2109Spec {
             // expected
         }
         try {
-            final List<Cookie> cookies = new ArrayList<Cookie>();
+            final List<Cookie> cookies = new ArrayList<>();
             cookiespec.formatCookies(cookies);
             Assert.fail("IllegalArgumentException must have been thrown");
         } catch (final IllegalArgumentException ex) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2965Spec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2965Spec.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2965Spec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestCookieRFC2965Spec.java Sun May 24 14:24:26 2015
@@ -899,7 +899,7 @@ public class TestCookieRFC2965Spec {
         cookie1.setAttribute(ClientCookie.PATH_ATTR, "/");
         cookie1.setAttribute(ClientCookie.PORT_ATTR, "80,8080");
 
-        List<Cookie> cookies = new ArrayList<Cookie>();
+        List<Cookie> cookies = new ArrayList<>();
         cookies.add(cookie1);
         List<Header> headers = cookiespec.formatCookies(cookies);
         Assert.assertNotNull(headers);
@@ -917,7 +917,7 @@ public class TestCookieRFC2965Spec {
         cookie2.setAttribute(ClientCookie.DOMAIN_ATTR, ".domain.com");
         cookie2.setAttribute(ClientCookie.PATH_ATTR, "/a/");
 
-        cookies = new ArrayList<Cookie>();
+        cookies = new ArrayList<>();
         cookies.add(cookie2);
         headers = cookiespec.formatCookies(cookies);
         Assert.assertNotNull(headers);
@@ -934,7 +934,7 @@ public class TestCookieRFC2965Spec {
         cookie3.setAttribute(ClientCookie.PATH_ATTR, "/a/b/");
         cookie3.setAttribute(ClientCookie.PORT_ATTR, "  ");
 
-        cookies = new ArrayList<Cookie>();
+        cookies = new ArrayList<>();
         cookies.add(cookie3);
         headers = cookiespec.formatCookies(cookies);
         Assert.assertNotNull(headers);
@@ -942,7 +942,7 @@ public class TestCookieRFC2965Spec {
         Assert.assertEquals("$Version=1; name3=\"value\"; $Path=\"/a/b/\"; $Port=\"\"",
                 headers.get(0).getValue());
 
-        cookies = new ArrayList<Cookie>();
+        cookies = new ArrayList<>();
         cookies.add(cookie3);
         cookies.add(cookie2);
         cookies.add(cookie1);
@@ -981,7 +981,7 @@ public class TestCookieRFC2965Spec {
         cookie2.setAttribute(ClientCookie.DOMAIN_ATTR, ".domain.com");
         cookie2.setAttribute(ClientCookie.PATH_ATTR, "/");
 
-        final List<Cookie> cookies = new ArrayList<Cookie>();
+        final List<Cookie> cookies = new ArrayList<>();
         cookies.add(cookie1);
         cookies.add(cookie2);
         final List<Header> headers = cookiespec.formatCookies(cookies);

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestDefaultCookieSpec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestDefaultCookieSpec.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestDefaultCookieSpec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/cookie/TestDefaultCookieSpec.java Sun May 24 14:24:26 2015
@@ -199,7 +199,7 @@ public class TestDefaultCookieSpec {
         cookie2.setPath("/");
         cookie2.setAttribute(ClientCookie.PATH_ATTR, cookie2.getPath());
 
-        final List<Cookie> cookies = new ArrayList<Cookie>();
+        final List<Cookie> cookies = new ArrayList<>();
         cookies.add(cookie1);
         cookies.add(cookie2);
 
@@ -232,7 +232,7 @@ public class TestDefaultCookieSpec {
         cookie2.setPath("/");
         cookie2.setAttribute(ClientCookie.PATH_ATTR, cookie2.getPath());
 
-        final List<Cookie> cookies = new ArrayList<Cookie>();
+        final List<Cookie> cookies = new ArrayList<>();
         cookies.add(cookie1);
         cookies.add(cookie2);
 
@@ -269,7 +269,7 @@ public class TestDefaultCookieSpec {
             // expected
         }
         try {
-            final List<Cookie> cookies = new ArrayList<Cookie>();
+            final List<Cookie> cookies = new ArrayList<>();
             cookiespec.formatCookies(cookies);
             Assert.fail("IllegalArgumentException must have been thrown");
         } catch (final IllegalArgumentException ex) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestMainClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestMainClientExec.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestMainClientExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestMainClientExec.java Sun May 24 14:24:26 2015
@@ -132,7 +132,7 @@ public class TestMainClientExec {
                 Mockito.<HttpRoute>any(), Mockito.any())).thenReturn(connRequest);
         Mockito.when(connRequest.get(
                 Mockito.anyLong(), Mockito.<TimeUnit>any())).thenReturn(managedConn);
-        final Map<String, Header> challenges = new HashMap<String, Header>();
+        final Map<String, Header> challenges = new HashMap<>();
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=test"));
         final AuthOption authOption = new AuthOption(
                 new BasicScheme(), new UsernamePasswordCredentials("user:pass"));
@@ -149,7 +149,7 @@ public class TestMainClientExec {
                 Mockito.eq(target),
                 Mockito.<HttpResponse>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(
-                new LinkedList<AuthOption>(Arrays.asList(authOption)));
+                new LinkedList<>(Arrays.asList(authOption)));
         Mockito.when(proxyAuthStrategy.getChallenges(
                 Mockito.eq(proxy),
                 Mockito.<HttpResponse>any(),
@@ -163,7 +163,7 @@ public class TestMainClientExec {
                 Mockito.eq(proxy),
                 Mockito.<HttpResponse>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(
-                new LinkedList<AuthOption>(Arrays.asList(authOption)));
+                new LinkedList<>(Arrays.asList(authOption)));
 
     }
 

Modified: httpcomponents/httpclient/trunk/httpmime/src/examples/org/apache/http/examples/entity/mime/ClientMultipartFormPost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpmime/src/examples/org/apache/http/examples/entity/mime/ClientMultipartFormPost.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpmime/src/examples/org/apache/http/examples/entity/mime/ClientMultipartFormPost.java (original)
+++ httpcomponents/httpclient/trunk/httpmime/src/examples/org/apache/http/examples/entity/mime/ClientMultipartFormPost.java Sun May 24 14:24:26 2015
@@ -49,8 +49,7 @@ public class ClientMultipartFormPost {
             System.out.println("File path not given");
             System.exit(1);
         }
-        CloseableHttpClient httpclient = HttpClients.createDefault();
-        try {
+        try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
             HttpPost httppost = new HttpPost("http://localhost:8080" +
                     "/servlets-examples/servlet/RequestInfoExample");
 
@@ -66,8 +65,7 @@ public class ClientMultipartFormPost {
             httppost.setEntity(reqEntity);
 
             System.out.println("executing request " + httppost.getRequestLine());
-            CloseableHttpResponse response = httpclient.execute(httppost);
-            try {
+            try (CloseableHttpResponse response = httpclient.execute(httppost)) {
                 System.out.println("----------------------------------------");
                 System.out.println(response.getStatusLine());
                 HttpEntity resEntity = response.getEntity();
@@ -75,11 +73,7 @@ public class ClientMultipartFormPost {
                     System.out.println("Response content length: " + resEntity.getContentLength());
                 }
                 EntityUtils.consume(resEntity);
-            } finally {
-                response.close();
             }
-        } finally {
-            httpclient.close();
         }
     }
 

Modified: httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/Header.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/Header.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/Header.java (original)
+++ httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/Header.java Sun May 24 14:24:26 2015
@@ -46,8 +46,8 @@ public class Header implements Iterable<
 
     public Header() {
         super();
-        this.fields = new LinkedList<MinimalField>();
-        this.fieldMap = new HashMap<String, List<MinimalField>>();
+        this.fields = new LinkedList<>();
+        this.fieldMap = new HashMap<>();
     }
 
     public void addField(final MinimalField field) {
@@ -57,7 +57,7 @@ public class Header implements Iterable<
         final String key = field.getName().toLowerCase(Locale.ROOT);
         List<MinimalField> values = this.fieldMap.get(key);
         if (values == null) {
-            values = new LinkedList<MinimalField>();
+            values = new LinkedList<>();
             this.fieldMap.put(key, values);
         }
         values.add(field);
@@ -65,7 +65,7 @@ public class Header implements Iterable<
     }
 
     public List<MinimalField> getFields() {
-        return new ArrayList<MinimalField>(this.fields);
+        return new ArrayList<>(this.fields);
     }
 
     public MinimalField getField(final String name) {
@@ -89,7 +89,7 @@ public class Header implements Iterable<
         if (list == null || list.isEmpty()) {
             return Collections.emptyList();
         } else {
-            return new ArrayList<MinimalField>(list);
+            return new ArrayList<>(list);
         }
     }
 

Modified: httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java (original)
+++ httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java Sun May 24 14:24:26 2015
@@ -126,7 +126,7 @@ public class MultipartEntityBuilder {
             return this;
         }
         if (this.bodyParts == null) {
-            this.bodyParts = new ArrayList<FormBodyPart>();
+            this.bodyParts = new ArrayList<>();
         }
         this.bodyParts.add(bodyPart);
         return this;
@@ -200,7 +200,7 @@ public class MultipartEntityBuilder {
         if (charsetCopy == null && contentType != null) {
             charsetCopy = contentType.getCharset();
         }
-        final List<NameValuePair> paramsList = new ArrayList<NameValuePair>(2);
+        final List<NameValuePair> paramsList = new ArrayList<>(2);
         paramsList.add(new BasicNameValuePair("boundary", boundaryCopy));
         if (charsetCopy != null) {
             paramsList.add(new BasicNameValuePair("charset", charsetCopy.name()));
@@ -209,7 +209,7 @@ public class MultipartEntityBuilder {
         final ContentType contentTypeCopy = contentType != null ?
                 contentType.withParameters(params) :
                 ContentType.create("multipart/" + DEFAULT_SUBTYPE, params);
-        final List<FormBodyPart> bodyPartsCopy = bodyParts != null ? new ArrayList<FormBodyPart>(bodyParts) :
+        final List<FormBodyPart> bodyPartsCopy = bodyParts != null ? new ArrayList<>(bodyParts) :
                 Collections.<FormBodyPart>emptyList();
         final HttpMultipartMode modeCopy = mode != null ? mode : HttpMultipartMode.STRICT;
         final AbstractMultipartForm form;

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

Modified: httpcomponents/httpclient/trunk/httpmime/src/test/java/org/apache/http/entity/mime/TestMultipartForm.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpmime/src/test/java/org/apache/http/entity/mime/TestMultipartForm.java?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpmime/src/test/java/org/apache/http/entity/mime/TestMultipartForm.java (original)
+++ httpcomponents/httpclient/trunk/httpmime/src/test/java/org/apache/http/entity/mime/TestMultipartForm.java Sun May 24 14:24:26 2015
@@ -136,11 +136,8 @@ public class TestMultipartForm {
     @Test
     public void testMultipartFormBinaryParts() throws Exception {
         tmpfile = File.createTempFile("tmp", ".bin");
-        final Writer writer = new FileWriter(tmpfile);
-        try {
+        try (Writer writer = new FileWriter(tmpfile)) {
             writer.append("some random whatever");
-        } finally {
-            writer.close();
         }
 
         final FormBodyPart p1 = FormBodyPartBuilder.create(
@@ -181,11 +178,8 @@ public class TestMultipartForm {
     @Test
     public void testMultipartFormStrict() throws Exception {
         tmpfile = File.createTempFile("tmp", ".bin");
-        final Writer writer = new FileWriter(tmpfile);
-        try {
+        try (Writer writer = new FileWriter(tmpfile)) {
             writer.append("some random whatever");
-        } finally {
-            writer.close();
         }
 
         final FormBodyPart p1 = FormBodyPartBuilder.create(
@@ -236,11 +230,8 @@ public class TestMultipartForm {
     @Test
     public void testMultipartFormRFC6532() throws Exception {
         tmpfile = File.createTempFile("tmp", ".bin");
-        final Writer writer = new FileWriter(tmpfile);
-        try {
+        try (Writer writer = new FileWriter(tmpfile)) {
             writer.append("some random whatever");
-        } finally {
-            writer.close();
         }
 
         final FormBodyPart p1 = FormBodyPartBuilder.create(
@@ -313,11 +304,8 @@ public class TestMultipartForm {
         final String s2 = constructString(RUSSIAN_HELLO);
 
         tmpfile = File.createTempFile("tmp", ".bin");
-        final Writer writer = new FileWriter(tmpfile);
-        try {
+        try (Writer writer = new FileWriter(tmpfile)) {
             writer.append("some random whatever");
-        } finally {
-            writer.close();
         }
 
         @SuppressWarnings("resource")

Modified: httpcomponents/httpclient/trunk/pom.xml
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/pom.xml?rev=1681461&r1=1681460&r2=1681461&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/pom.xml (original)
+++ httpcomponents/httpclient/trunk/pom.xml Sun May 24 14:24:26 2015
@@ -64,8 +64,8 @@
   </scm>
 
   <properties>
-    <maven.compiler.source>1.6</maven.compiler.source>
-    <maven.compiler.target>1.6</maven.compiler.target>
+    <maven.compiler.source>1.7</maven.compiler.source>
+    <maven.compiler.target>1.7</maven.compiler.target>
     <httpcore.version>4.4.1</httpcore.version>
     <commons-logging.version>1.2</commons-logging.version>
     <commons-codec.version>1.9</commons-codec.version>
@@ -77,7 +77,6 @@
     <mockito.version>1.8.5</mockito.version>
     <jna.version>4.1.0</jna.version>
     <hc.stylecheck.version>1</hc.stylecheck.version>
-    <api.comparison.version>4.4</api.comparison.version>
   </properties>
 
   <dependencyManagement>
@@ -400,15 +399,6 @@
         </reportSets>
       </plugin>
 
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>clirr-maven-plugin</artifactId>
-        <version>${hc.clirr.version}</version>
-        <configuration>
-          <comparisonVersion>${api.comparison.version}</comparisonVersion>
-        </configuration>
-      </plugin>
-
     </plugins>
   </reporting>
 



Mime
View raw message