HBASE-7355. NPE in ClusterStatus PB conversion

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1422076 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Kyle Purtell 2012-12-14 21:03:33 +00:00
parent 5c5c60f882
commit 5dbff1427d
1 changed files with 5 additions and 1 deletions

View File

@ -337,7 +337,11 @@ public class ClusterStatus extends VersionedWritable {
RegionState value = RegionState.convert(region.getRegionState());
rit.put(key,value);
}
final String[] masterCoprocessors = proto.getMasterCoprocessorsList().toArray(new String[0]);
final int numMasterCoprocessors = proto.getMasterCoprocessorsCount();
final String[] masterCoprocessors = new String[numMasterCoprocessors];
for (int i = 0; i < numMasterCoprocessors; i++) {
masterCoprocessors[i] = proto.getMasterCoprocessors(i).getName();
}
return new ClusterStatus(proto.getHbaseVersion().getVersion(),
ClusterId.convert(proto.getClusterId()).toString(),servers,deadServers,
ProtobufUtil.toServerName(proto.getMaster()),backupMasters,rit,masterCoprocessors,