You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2019/05/30 04:56:08 UTC

[hbase] branch master updated: HBASE-22476 FSDataInputStream is not closed. (#263)

This is an automated email from the ASF dual-hosted git repository.

stack pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new 2823090  HBASE-22476 FSDataInputStream is not closed. (#263)
2823090 is described below

commit 2823090ce470ca6c016da470123e0b9dce2d32b6
Author: lixiaobao <li...@mininglamp.com>
AuthorDate: Thu May 30 12:56:04 2019 +0800

    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 <zh...@apache.org>
---
 .../java/org/apache/hadoop/hbase/backup/impl/BackupManifest.java   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupManifest.java b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupManifest.java
index 4c38219..049d38b 100644
--- a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupManifest.java
+++ b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupManifest.java
@@ -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);