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 63a32f364303c6e2158c43fb7f516cfb6d84e680
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Thu Apr 3 10:43:46 2025 -0400

    Pass the class' builder internally
---
 .../apache/commons/io/output/RandomAccessFileOutputStream.java    | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/io/output/RandomAccessFileOutputStream.java 
b/src/main/java/org/apache/commons/io/output/RandomAccessFileOutputStream.java
index d9c270134..42685c6a2 100644
--- 
a/src/main/java/org/apache/commons/io/output/RandomAccessFileOutputStream.java
+++ 
b/src/main/java/org/apache/commons/io/output/RandomAccessFileOutputStream.java
@@ -22,7 +22,6 @@
 import java.io.OutputStream;
 import java.io.RandomAccessFile;
 import java.nio.file.StandardOpenOption;
-import java.util.Objects;
 
 import org.apache.commons.io.build.AbstractOrigin;
 import org.apache.commons.io.build.AbstractStreamBuilder;
@@ -85,10 +84,9 @@ private Builder() {
          * @see AbstractOrigin#getFile()
          * @see #getUnchecked()
          */
-        @SuppressWarnings("resource") // caller closes
         @Override
         public RandomAccessFileOutputStream get() throws IOException {
-            return new RandomAccessFileOutputStream(getRandomAccessFile());
+            return new RandomAccessFileOutputStream(this);
         }
 
     }
@@ -104,8 +102,8 @@ public static Builder builder() {
 
     private final RandomAccessFile randomAccessFile;
 
-    private RandomAccessFileOutputStream(final RandomAccessFile 
randomAccessFile) {
-        this.randomAccessFile = Objects.requireNonNull(randomAccessFile);
+    private RandomAccessFileOutputStream(final Builder builder) throws 
IOException {
+        this.randomAccessFile = builder.getRandomAccessFile();
     }
 
     @Override

Reply via email to