@Override protected synchronized void setApplication(Application app) { if (app.getId().equals(getId())) { application = getProxy() != null ? (Application) getProxy() : app; } else { application = app; // Alex, Mar 2013: added some checks; // i *think* these conditions should not happen, // and so should throw but don't want to break things (yet) if (getParent() == null) { log.warn( "Setting application of " + this + " to " + app + ", but " + this + " is not parented"); } else if (getParent().getApplicationId().equals(app.getParent())) { log.warn( "Setting application of " + this + " to " + app + ", but parent " + getParent() + " has different app " + getParent().getApplication()); } } super.setApplication(app); }