You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2015/08/27 06:44:21 UTC

svn commit: r1698067 - /httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java

Author: ggregory
Date: Thu Aug 27 04:44:21 2015
New Revision: 1698067

URL: http://svn.apache.org/r1698067
Log:
Use try-with-resources.

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java?rev=1698067&r1=1698066&r2=1698067&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java Thu Aug 27 04:44:21 2015
@@ -353,8 +353,7 @@ public class HttpAsyncService implements
             final int status = response.getStatusLine().getStatusCode();
             if (status == 100) {
                 final HttpContext context = outgoing.getContext();
-                final HttpAsyncResponseProducer responseProducer = outgoing.getProducer();
-                try {
+                try (final HttpAsyncResponseProducer responseProducer = outgoing.getProducer()) {
                     // Make sure 100 response has no entity
                     response.setEntity(null);
                     conn.requestInput();
@@ -362,8 +361,6 @@ public class HttpAsyncService implements
                     state.setOutgoing(null);
                     conn.submitResponse(response);
                     responseProducer.responseCompleted(context);
-                } finally {
-                    responseProducer.close();
                 }
             } else if (status >= 400) {
                 conn.resetInput();