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 6798ec0ffe1de0884dade8466d7aa01e49c47f69
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Aug 25 12:08:32 2024 -0400

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

diff --git 
a/src/test/java/org/apache/commons/fileupload/DefaultFileItemTest.java 
b/src/test/java/org/apache/commons/fileupload/DefaultFileItemTest.java
index c0daca09..05263f42 100644
--- a/src/test/java/org/apache/commons/fileupload/DefaultFileItemTest.java
+++ b/src/test/java/org/apache/commons/fileupload/DefaultFileItemTest.java
@@ -141,10 +141,8 @@ public class DefaultFileItemTest {
         );
         assertNotNull(item);
 
-        try {
-            final OutputStream os = item.getOutputStream();
+        try (OutputStream os = item.getOutputStream()) {
             os.write(testFieldValueBytes);
-            os.close();
         } catch(final IOException e) {
             fail("Unexpected IOException");
         }

Reply via email to