Skip to content

Commit 2823090

Browse files
lixiaobaosaintstack
authored andcommitted
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>
1 parent 1be93fc commit 2823090

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupManifest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,10 +434,13 @@ public BackupManifest(FileSystem fs, Path backupPath) throws BackupException {
434434
for (FileStatus subFile : subFiles) {
435435
if (subFile.getPath().getName().equals(MANIFEST_FILE_NAME)) {
436436
// load and set manifest field from file content
437-
FSDataInputStream in = fs.open(subFile.getPath());
438437
long len = subFile.getLen();
439438
byte[] pbBytes = new byte[(int) len];
440-
in.readFully(pbBytes);
439+
try (FSDataInputStream in = fs.open(subFile.getPath())) {
440+
in.readFully(pbBytes);
441+
} catch (IOException e) {
442+
throw new BackupException(e.getMessage());
443+
}
441444
BackupProtos.BackupImage proto = null;
442445
try {
443446
proto = BackupProtos.BackupImage.parseFrom(pbBytes);

0 commit comments

Comments
 (0)