diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java index cfca6daa73d..0cb41140379 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java @@ -305,6 +305,9 @@ public interface RegionInfo { break; } } + if (offset <= 0) { + throw new IllegalArgumentException("offset=" + offset); + } byte[] buff = new byte[offset]; System.arraycopy(regionName, 0, buff, 0, offset); return TableName.valueOf(buff); diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroups.java b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroups.java index 9a58097ecbb..f2ae112c602 100644 --- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroups.java +++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroups.java @@ -186,7 +186,7 @@ public class TestRSGroups extends TestRSGroupsBase { @Test public void testDefaultNamespaceCreateAndAssign() throws Exception { LOG.info("testDefaultNamespaceCreateAndAssign"); - final byte[] tableName = Bytes.toBytes(tablePrefix + "_testCreateAndAssign"); + String tableName = tablePrefix + "_testCreateAndAssign"; admin.modifyNamespace(NamespaceDescriptor.create("default") .addConfiguration(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP, "default").build()); final HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName));