hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1698070 - /httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestContentChannel.java
Date Thu, 27 Aug 2015 04:50:43 GMT
Author: ggregory
Date: Thu Aug 27 04:50:43 2015
New Revision: 1698070

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

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestContentChannel.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestContentChannel.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestContentChannel.java?rev=1698070&r1=1698069&r2=1698070&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestContentChannel.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestContentChannel.java
Thu Aug 27 04:50:43 2015
@@ -59,14 +59,11 @@ public class TestContentChannel {
 
     @Test
     public void testContentDecoder() throws Exception {
-        final ContentDecoderChannel cdc = new ContentDecoderChannel(decoder);
-
-        cdc.read(bb);
-        verify(decoder, times(1)).read(bb);
-
-        assertTrue(cdc.isOpen());
-
-        cdc.close();
+        try (final ContentDecoderChannel cdc = new ContentDecoderChannel(decoder)) {
+            cdc.read(bb);
+            verify(decoder, times(1)).read(bb);
+            assertTrue(cdc.isOpen());
+        }
     }
 
     @Test



Mime
View raw message