Skip to content

Commit

Permalink
close resouce in catch block
Browse files Browse the repository at this point in the history
  • Loading branch information
Nargeshdb committed Mar 2, 2021
1 parent 1f1a1ef commit 0f3e509
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ public EditLogFileOutputStream(Configuration conf, File name, int size)
} else {
rp = new RandomAccessFile(name, "rw");
}
fp = new FileOutputStream(rp.getFD()); // open for append
try {
fp = new FileOutputStream(rp.getFD()); // open for append
} catch (IOException e) {
IOUtils.closeStream(rp);
throw e;
}
fc = rp.getChannel();
fc.position(fc.size());
}
Expand Down

0 comments on commit 0f3e509

Please sign in to comment.