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:50:43 UTC
svn commit: r1698070 -
/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/TestContentChannel.java
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