Following code provokes a NPE the wrappedModel is null:
// also detach the wrapped model of a component assignet wrap (not
inherited)
if (model instanceof IWrapModel && !getFlag(FLAG_INHERITABLE_MODEL))
{
((IWrapModel)model).getWrappedModel().detach();
}
We have that case because we have an IContextWrapModel that wraps models
that are stored in a context outside of the component graph. It lazily looks
up the model by key in the context, and in its detach() it does the
following:
public void detach() {
if (wrappedModel instanceof IContextModel)
wrappedModel = null;
}
Two questions:
(1) Would it not be more correct to leave the 'detach' responsability to the
wrapModel implementation ?
(2) If not, can there be a check for null pointers in the code above ?
Jan
--
View this message in context:
http://www.nabble.com/NPE-in-Component.detachModel%28%29-when-wrappedModel-is-null-tf4048326.html#a11499084
Sent from the Wicket - Dev mailing list archive at Nabble.com.