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 2025/07/05 14:40:07 UTC

(commons-io) 04/20: Internal refactoring

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-io.git

commit 513e45eb71752df8317ed6c598a8a02bea9a1453
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sat Jul 5 10:01:18 2025 -0400

    Internal refactoring
---
 .../java/org/apache/commons/io/output/ProxyOutputStream.java     | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/output/ProxyOutputStream.java b/src/main/java/org/apache/commons/io/output/ProxyOutputStream.java
index 4c291777d..6d4edb7fa 100644
--- a/src/main/java/org/apache/commons/io/output/ProxyOutputStream.java
+++ b/src/main/java/org/apache/commons/io/output/ProxyOutputStream.java
@@ -68,14 +68,19 @@ public Builder() {
          * @see #getOutputStream()
          * @see #getUnchecked()
          */
-        @SuppressWarnings("resource") // caller closes
         @Override
         public ProxyOutputStream get() throws IOException {
-            return new ProxyOutputStream(getOutputStream());
+            return new ProxyOutputStream(this);
         }
 
     }
 
+    @SuppressWarnings("resource") // caller closes
+    ProxyOutputStream(final Builder builder) throws IOException {
+        // the delegate is stored in a protected superclass variable named 'out'
+        super(builder.getOutputStream());
+    }
+
     /**
      * Constructs a new ProxyOutputStream.
      *