}
/*
* Invalid byte found, i.e. one which is not element of { 11111111, 11111110,
* 11111100, 11111000, ..., 00000000 }
*/
throw new AccessControlException("Invalid byte in mask [" + addr2string(mask) + "]");
}
}
/* the remaining byte(s) (if any) must be 0: */
while (++i < mask.length) {
if (mask[i] != 0) {
/*
* Invalid byte found, i.e. some non-zero byte right of the first non-zero byte.
*/
throw new AccessControlException("Invalid non-zero byte in mask ["
+ addr2string(mask) + "]");
}
}
/* convert the checked mask to InetAddress: */
try {
subnetMask = InetAddress.getByAddress(mask);
} catch (UnknownHostException e) {
throw new AccessControlException(
"Failed to convert mask [" + addr2string(mask) + "]: ", e);
}
}