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 2017/03/31 18:49:05 UTC

svn commit: r1789728 - /httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/util/TestCharArrayBuffer.java

Author: ggregory
Date: Fri Mar 31 18:49:05 2017
New Revision: 1789728

URL: http://svn.apache.org/viewvc?rev=1789728&view=rev
Log:
Fix compiler warning: Use try-with-resources.

Modified:
    httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/util/TestCharArrayBuffer.java

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/util/TestCharArrayBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/util/TestCharArrayBuffer.java?rev=1789728&r1=1789727&r2=1789728&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/util/TestCharArrayBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/util/TestCharArrayBuffer.java Fri Mar 31 18:49:05 2017
@@ -382,9 +382,9 @@ public class TestCharArrayBuffer {
         orig.append('b');
         orig.append('c');
         final ByteArrayOutputStream outbuffer = new ByteArrayOutputStream();
-        final ObjectOutputStream outstream = new ObjectOutputStream(outbuffer);
-        outstream.writeObject(orig);
-        outstream.close();
+        try (final ObjectOutputStream outstream = new ObjectOutputStream(outbuffer)) {
+            outstream.writeObject(orig);
+        }
         final byte[] raw = outbuffer.toByteArray();
         final ByteArrayInputStream inbuffer = new ByteArrayInputStream(raw);
         final ObjectInputStream instream = new ObjectInputStream(inbuffer);