HBASE-22476 FSDataInputStream is not closed. (#263)

HBASE-22476 HBase-backup module's class "org.apache.hadoop.hbase.backup.impl.BackupManifest" FSDataInputStream is not close.

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
lixiaobao 2019-05-30 12:56:04 +08:00 committed by Michael Stack
parent 1be93fcaec
commit 2823090ce4
1 changed files with 5 additions and 2 deletions

View File

@ -434,10 +434,13 @@ public class BackupManifest {
for (FileStatus subFile : subFiles) {
if (subFile.getPath().getName().equals(MANIFEST_FILE_NAME)) {
// load and set manifest field from file content
FSDataInputStream in = fs.open(subFile.getPath());
long len = subFile.getLen();
byte[] pbBytes = new byte[(int) len];
in.readFully(pbBytes);
try (FSDataInputStream in = fs.open(subFile.getPath())) {
in.readFully(pbBytes);
} catch (IOException e) {
throw new BackupException(e.getMessage());
}
BackupProtos.BackupImage proto = null;
try {
proto = BackupProtos.BackupImage.parseFrom(pbBytes);