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:43 UTC
(commons-fileupload) 15/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 6798ec0ffe1de0884dade8466d7aa01e49c47f69
Author: Gary Gregory <ga...@gmail.com>
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");
}