public Object getDeclaredField(Class targetClass, String name, Object target)
throws Exception
{
if (System.getSecurityManager() != null)
{
Actions actions = (Actions) m_actions.get();
actions.set(Actions.GET_FIELD_ACTION, targetClass, name, target);
try
{
return AccessController.doPrivileged(actions, m_acc);
}
catch (PrivilegedActionException e)
{
throw e.getException();
}
}
else
{
Field field = targetClass.getDeclaredField(name);
field.setAccessible(true);
return field.get(target);
}
}
|