HDFS-15868. Possible Resource Leak in EditLogFileOutputStream (#2736). Contributed by Narges Shadab.
Reviewed-by: He Xiaoqiao <hexiaoqiao@apache.org>
(cherry picked from commit f5f3fc6fe9
)
This commit is contained in:
parent
4abe6e6ac1
commit
3a355282c9
|
@ -88,7 +88,12 @@ public class EditLogFileOutputStream extends EditLogOutputStream {
|
|||
} 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());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue