The patch below fixes the issue.
It reverses the sense of the test, and simply tests that each character is not a control character.
It also tidies up the error message slightly (removing the reference to ending with colons, since that is tested in a separate check)
Index: src/java/org/apache/hadoop/hbase/HColumnDescriptor.java
===================================================================
— src/java/org/apache/hadoop/hbase/HColumnDescriptor.java (revision 740857)
+++ src/java/org/apache/hadoop/hbase/HColumnDescriptor.java (working copy)
@@ -242,12 +242,11 @@
Bytes.toString(b));
}
for (int i = 0; i < (b.length - 1); i++) {
- if (Character.isLetterOrDigit(b[i]) || b[i] == '_' || b[i] == '.') {
- continue;
+ if (Character.isISOControl(b[i]))
{
+ throw new IllegalArgumentException("Illegal character <" + b[i] +
+ ">. Family names cannot contain control characters: " +
+ Bytes.toString(b));
}
- throw new IllegalArgumentException("Illegal character <" + b[i] +
- ">. Family names can only contain 'word characters' and must end" +
- "with a colon: " + Bytes.toString(b));
}
return b;
}
The patch below fixes the issue.
It reverses the sense of the test, and simply tests that each character is not a control character.
It also tidies up the error message slightly (removing the reference to ending with colons, since that is tested in a separate check)
Index: src/java/org/apache/hadoop/hbase/HColumnDescriptor.java
===================================================================
— src/java/org/apache/hadoop/hbase/HColumnDescriptor.java (revision 740857)
+++ src/java/org/apache/hadoop/hbase/HColumnDescriptor.java (working copy)
@@ -242,12 +242,11 @@
Bytes.toString(b));
}
for (int i = 0; i < (b.length - 1); i++) {
+ if (Character.isISOControl(b[i])) { + throw new IllegalArgumentException("Illegal character <" + b[i] + + ">. Family names cannot contain control characters: " + + Bytes.toString(b)); }
}
return b;
}