diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptorBuilder.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptorBuilder.java index 53703211979..7301315e60b 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptorBuilder.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptorBuilder.java @@ -1068,6 +1068,10 @@ public class TableDescriptorBuilder { if (family.getName() == null || family.getName().length <= 0) { throw new IllegalArgumentException("Family name cannot be null or empty"); } + int flength = family.getName() == null ? 0 : family.getName().length; + if (flength > Byte.MAX_VALUE) { + throw new IllegalArgumentException("The length of family name is bigger than " + Byte.MAX_VALUE); + } if (hasColumnFamily(family.getName())) { throw new IllegalArgumentException("Family '" + family.getNameAsString() + "' already exists so cannot be added");