HBASE-5424 HTable meet NPE when call getRegionInfo()

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1292645 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2012-02-23 04:43:29 +00:00
parent c3575d2eb5
commit 6a80cf5bf9
1 changed files with 14 additions and 12 deletions

View File

@ -449,10 +449,11 @@ public class HTable implements HTableInterface {
MetaScannerVisitor visitor = new MetaScannerVisitor() { MetaScannerVisitor visitor = new MetaScannerVisitor() {
public boolean processRow(Result rowResult) throws IOException { public boolean processRow(Result rowResult) throws IOException {
HRegionInfo info = Writables.getHRegionInfo( HRegionInfo info = Writables.getHRegionInfoOrNull(
rowResult.getValue(HConstants.CATALOG_FAMILY, rowResult.getValue(HConstants.CATALOG_FAMILY,
HConstants.REGIONINFO_QUALIFIER)); HConstants.REGIONINFO_QUALIFIER));
if (info != null) {
if (!(Bytes.equals(info.getTableName(), getTableName()))) { if (!(Bytes.equals(info.getTableName(), getTableName()))) {
return false; return false;
} }
@ -468,6 +469,7 @@ public class HTable implements HTableInterface {
if (!(info.isOffline() || info.isSplit())) { if (!(info.isOffline() || info.isSplit())) {
regionMap.put(new UnmodifyableHRegionInfo(info), server); regionMap.put(new UnmodifyableHRegionInfo(info), server);
} }
}
return true; return true;
} }