Policy policy = getPolicy();
if (!(policy instanceof DynamicPolicy)) {
throw new UnsupportedOperationException("grants not supported");
}
DynamicPolicy dpolicy = (DynamicPolicy) policy;
Principal[] principals = getCurrentPrincipals();
Permission[] permissions =
grantablePermissions(dpolicy.getGrants(fromClass, principals));
dpolicy.grant(toClass, principals, permissions);
if (policyLogger.isLoggable(Level.FINER)) {
policyLogger.log(Level.FINER, "granted {0} from {1} to {2}, {3}",
new Object[]{
(permissions != null) ? Arrays.asList(permissions) : null,
fromClass.getName(),