if (noNull && object == null) {
throw new NoSuchObjectException(id, aClass);
}
if (notify && object != null) {
ThreadContext.getDependencyMap().addResponseDependency(object);
WebApp webContext = WebApp.get();
if (webContext != null) {
if (webContext.getSecurityManager().hasAccess(object)) {
return object;
} else {
throw new AccessDeniedException("Access rights to " + aClass.getName() + " with id " + id + " could not be proven");
}
}