Skip to content

Commit 60095a4

Browse files
committed
Internal refactoring
1 parent 9d90c9b commit 60095a4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/main/java/org/apache/commons/io/serialization/ValidatingObjectInputStream.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public Builder accept(final String... patterns) {
188188
*/
189189
@Override
190190
public ValidatingObjectInputStream get() throws IOException {
191-
return new ValidatingObjectInputStream(getInputStream(), predicate);
191+
return new ValidatingObjectInputStream(this);
192192
}
193193

194194
/**
@@ -276,6 +276,11 @@ public static Builder builder() {
276276

277277
private final ObjectStreamClassPredicate predicate;
278278

279+
@SuppressWarnings("resource") // caller closes/
280+
private ValidatingObjectInputStream(final Builder builder) throws IOException {
281+
this(builder.getInputStream(), builder.predicate);
282+
}
283+
279284
/**
280285
* Constructs an instance to deserialize the specified input stream. At least one accept method needs to be called to specify which classes can be
281286
* deserialized, as by default no classes are accepted.

0 commit comments

Comments
 (0)