Skip to content

Commit e5c4d14

Browse files
committed
Pass the class' builder internally
1 parent 57d47cf commit e5c4d14

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/main/java/org/apache/commons/io/output/UncheckedFilterWriter.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public Builder() {
9292
*/
9393
@Override
9494
public UncheckedFilterWriter get() throws IOException {
95-
return new UncheckedFilterWriter(getWriter());
95+
return new UncheckedFilterWriter(this);
9696
}
9797

9898
}
@@ -109,11 +109,14 @@ public static Builder builder() {
109109
/**
110110
* Constructs a new filtered writer.
111111
*
112-
* @param writer a Writer object providing the underlying stream.
113-
* @throws NullPointerException if {@code writer} is {@code null}.
112+
* @param builder a Writer object providing the underlying stream.
113+
* @throws IOException
114+
* @throws NullPointerException if {@code builder} the its {@code Writer} is {@code null}.
115+
* @throws IOException if an I/O error occurs converting to an {@link Writer} using {@link #getWriter()}.
114116
*/
115-
private UncheckedFilterWriter(final Writer writer) {
116-
super(writer);
117+
@SuppressWarnings("resource") // Caller closes.
118+
private UncheckedFilterWriter(final Builder builder) throws IOException {
119+
super(builder.getWriter());
117120
}
118121

119122
/**

0 commit comments

Comments
 (0)