Skip to content

Commit

Permalink
[LOGBACK-1755] Close streams
Browse files Browse the repository at this point in the history
Signed-off-by: Alfusainey Jallow <alf.jallow@gmail.com>
  • Loading branch information
Alfusainey authored and ceki committed Jul 11, 2023
1 parent 776efa7 commit 9fd7d96
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,14 @@ public void test3() throws Exception {
}

private void copy(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
try (InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);) {
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
}
in.close();
out.close();
}

}

0 comments on commit 9fd7d96

Please sign in to comment.