You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/08/25 21:11:37 UTC

(commons-fileupload) 09/22: Use try-with-resources

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/commons-fileupload.git

commit cfc40dccb287923feec2e5372c891f9de4be409e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Aug 25 12:04:16 2024 -0400

    Use try-with-resources
---
 src/test/java/org/apache/commons/fileupload/SizesTest.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/commons/fileupload/SizesTest.java b/src/test/java/org/apache/commons/fileupload/SizesTest.java
index 66c38613..13c3aa95 100644
--- a/src/test/java/org/apache/commons/fileupload/SizesTest.java
+++ b/src/test/java/org/apache/commons/fileupload/SizesTest.java
@@ -257,8 +257,7 @@ public class SizesTest {
         assertEquals("file1", item.getFieldName());
         assertEquals("foo1.tab", item.getName());
 
-        {
-            final InputStream stream = item.openStream();
+        try (InputStream stream = item.openStream()) {
             final ByteArrayOutputStream baos = new ByteArrayOutputStream();
             Streams.copy(stream, baos, true);
         }