* Checks that this label is valid.
* @throws InvalidNameException if label is not valid.
*/
private static void verifyLabel(String label) throws InvalidNameException {
if (label.length() > 63) {
throw new InvalidNameException(
"Label exceeds 63 octets: " + label);
}
// Check for two-byte characters.
for (int i = 0; i < label.length(); i++) {
char c = label.charAt(i);
if ((c & 0xFF00) != 0) {
throw new InvalidNameException(
"Label has two-byte char: " + label);
}
}
}