HBASE-10036 Fix Potential Resource Leak in MetaReader

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1545871 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
eclark 2013-11-26 22:28:57 +00:00
parent cc0d80fada
commit fc67c8a8b8
1 changed files with 3 additions and 2 deletions

View File

@ -533,8 +533,9 @@ public class MetaReader {
} }
scan.addFamily(HConstants.CATALOG_FAMILY); scan.addFamily(HConstants.CATALOG_FAMILY);
HTable metaTable = getMetaHTable(catalogTracker); HTable metaTable = getMetaHTable(catalogTracker);
ResultScanner scanner = metaTable.getScanner(scan); ResultScanner scanner = null;
try { try {
scanner = metaTable.getScanner(scan);
Result data; Result data;
while((data = scanner.next()) != null) { while((data = scanner.next()) != null) {
if (data.isEmpty()) continue; if (data.isEmpty()) continue;
@ -542,7 +543,7 @@ public class MetaReader {
if (!visitor.visit(data)) break; if (!visitor.visit(data)) break;
} }
} finally { } finally {
scanner.close(); if (scanner != null) scanner.close();
metaTable.close(); metaTable.close();
} }
return; return;