HDFS-15868. Possible Resource Leak in EditLogFileOutputStream (#2736). Contributed by Narges Shadab.
Reviewed-by: He Xiaoqiao <hexiaoqiao@apache.org>
This commit is contained in:
parent
3d4ea4b336
commit
f5f3fc6fe9
@ -88,7 +88,12 @@ public EditLogFileOutputStream(Configuration conf, File name, int size)
|
||||
} else {
|
||||
rp = new RandomAccessFile(name, "rws");
|
||||
}
|
||||
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
Block a user