* @throws AccessControlException If the specified array is null
* or if it contains an unregistered privilege.
*/
public static int getBits(Privilege[] privileges) throws AccessControlException {
if (privileges == null || privileges.length == 0) {
throw new AccessControlException();
}
int bits = NO_PRIVILEGE;
for (int i = 0; i < privileges.length; i++) {
Privilege priv = privileges[i];
if (priv instanceof PrivilegeImpl) {
bits |= ((PrivilegeImpl) priv).internalPrivilege.getBits();
} else {
throw new AccessControlException("Unknown privilege '" + priv.getName() + "'.");
}
}
return bits;
}