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

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

commit 3acb086412f6a8236a99345d33f53dd9468e6bf6
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Fri Jun 13 11:00:19 2025 -0400

    Reuse NullOutputStream
---
 .../apache/commons/fileupload2/core/MultipartStreamTest.java   | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git 
a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/MultipartStreamTest.java
 
b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/MultipartStreamTest.java
index 06aa733e..366eb340 100644
--- 
a/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/MultipartStreamTest.java
+++ 
b/commons-fileupload2-core/src/test/java/org/apache/commons/fileupload2/core/MultipartStreamTest.java
@@ -28,6 +28,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
 
+import org.apache.commons.io.output.NullOutputStream;
 import org.junit.jupiter.api.Test;
 
 /**
@@ -54,20 +55,13 @@ class MultipartStreamTest {
         assertNotNull(mi);
         try {
             boolean nextPart = mi.skipPreamble();
-            final OutputStream nullOutput = new OutputStream() {
-
-                @Override
-                public void write(final int pB) throws IOException {
-                    // Do nothing. (Null output)
-                }
-            };
             while (nextPart) {
                 final String headers = mi.readHeaders();
                 System.out.print("Headers=" + headers.length() + ", " + 
headers);
                 assertNotNull(headers);
                 // process headers
                 // create some output stream
-                mi.readBodyData(nullOutput);
+                mi.readBodyData(NullOutputStream.INSTANCE);
                 nextPart = mi.readBoundary();
             }
             fail("Expected Exception");

Reply via email to