try {
Field pkField = null;
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
try {
pkField = (Field)AccessController.doPrivileged(new PrivilegedGetField(object.getClass(), field.getName(), true));
AccessController.doPrivileged(new PrivilegedSetValueInField(pkField, object, value));
} catch (PrivilegedActionException exception) {
throw DescriptorException.errorUsingPrimaryKey(object, getDescriptor(), exception.getException());
}
} else {
pkField = PrivilegedAccessHelper.getField(object.getClass(), field.getName(), true);