// Sort roles before adding it to the signature to preserve the order
Arrays.sort(roles);
}
for (int r = 0; r < roles.length; r++) {
try {
signature.update(((String)roles[r]).getBytes());
} catch (SignatureException e) {
if (logger.isLoggable(BasicLevel.ERROR))
logger.log(BasicLevel.ERROR, "EXCEPTION:: validate", e);
throw new Exception("Cannot add the bytes for the role '" + roles[r] + "' : " + e.getMessage());
}