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 0372899823d28cb0ab86126c344dc929fe1f57cf Author: Gary Gregory <[email protected]> AuthorDate: Sun Aug 25 12:07:21 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 844f6601..fe7a6f78 100644 --- a/src/test/java/org/apache/commons/fileupload/DefaultFileItemTest.java +++ b/src/test/java/org/apache/commons/fileupload/DefaultFileItemTest.java @@ -209,10 +209,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"); }
