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/04/03 14:55:40 UTC
(commons-io) 06/06: Pass the class' builder internally
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 e5c4d1476380fa92cfd15a4c14cc446df4ed2770
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Thu Apr 3 10:55:29 2025 -0400
Pass the class' builder internally
---
.../org/apache/commons/io/output/UncheckedFilterWriter.java | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/commons/io/output/UncheckedFilterWriter.java b/src/main/java/org/apache/commons/io/output/UncheckedFilterWriter.java
index ba53a0fcd..e2d73c677 100644
--- a/src/main/java/org/apache/commons/io/output/UncheckedFilterWriter.java
+++ b/src/main/java/org/apache/commons/io/output/UncheckedFilterWriter.java
@@ -92,7 +92,7 @@ public Builder() {
*/
@Override
public UncheckedFilterWriter get() throws IOException {
- return new UncheckedFilterWriter(getWriter());
+ return new UncheckedFilterWriter(this);
}
}
@@ -109,11 +109,14 @@ public static Builder builder() {
/**
* Constructs a new filtered writer.
*
- * @param writer a Writer object providing the underlying stream.
- * @throws NullPointerException if {@code writer} is {@code null}.
+ * @param builder a Writer object providing the underlying stream.
+ * @throws IOException
+ * @throws NullPointerException if {@code builder} the its {@code Writer} is {@code null}.
+ * @throws IOException if an I/O error occurs converting to an {@link Writer} using {@link #getWriter()}.
*/
- private UncheckedFilterWriter(final Writer writer) {
- super(writer);
+ @SuppressWarnings("resource") // Caller closes.
+ private UncheckedFilterWriter(final Builder builder) throws IOException {
+ super(builder.getWriter());
}
/**