Skip to content

Commit 295efa9

Browse files
authored
Refactor writeTo method to use try-with-resources
1 parent b23fb14 commit 295efa9

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

src/main/java/com/merge/legacy/api/core/InputStreamRequestBody.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,8 @@ public long contentLength() throws IOException {
6868
*/
6969
@Override
7070
public void writeTo(BufferedSink sink) throws IOException {
71-
Source source = null;
72-
try {
73-
source = Okio.source(inputStream);
71+
try (Source source = Okio.source(inputStream)) {
7472
sink.writeAll(source);
75-
} finally {
76-
Util.closeQuietly(Objects.requireNonNull(source));
7773
}
7874
}
7975
}

0 commit comments

Comments
 (0)