Description
Hit an issue where there's an error in contributed properties (from service) throwing NPE, due to mismatch of push/pop with interactoin execution graph.
Mixins work fine.
Rather than fix the inconsistency, think it's better to now remove that functionality (as we've planned a long while now).
Details of the problem encountered:
in the current HEAD (2.0.0-M3-SNAPSHOT), I am getting an NPE as the result of the presence of this contributed action (nb: contributed from a service):
public class SimpleObjects { @Action(semantics = SemanticsOf.SAFE) public SimpleObject search(final SimpleObject simpleObject) { return simpleObject; } public List<SimpleObject> autoComplete0Search(final String search) { return findByName(search); } ... }
The NPE occurs in the stuff around Interaction's execution:
Stack trace:
- java.lang.NullPointerException
- org.apache.isis.applib.util.schema.MemberExecutionDtoUtils#metricsFor(MemberExecutionDtoUtils.java:77)
- org.apache.isis.applib.services.iactn.Interaction$Execution$When#metricsFor(Interaction.java:640)
- org.apache.isis.applib.services.iactn.Interaction$Execution$When#access$200(Interaction.java:582)
- org.apache.isis.applib.services.iactn.Interaction$Execution$When$2#syncMetrics(Interaction.java:613)
- org.apache.isis.applib.services.iactn.Interaction$Execution#syncMetrics(Interaction.java:660)
- org.apache.isis.applib.services.iactn.Interaction$Execution#setCompletedAt(Interaction.java:503)
- org.apache.isis.applib.services.iactn.Interaction#pop(Interaction.java:246)
- org.apache.isis.applib.services.iactn.Interaction#executeInternal(Interaction.java:193)
- org.apache.isis.applib.services.iactn.Interaction#execute(Interaction.java:142)
- org.apache.isis.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract#doInvoke(ActionInvocationFacetForDomainEventAbstract.java:208)
- org.apache.isis.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract#lambda$invoke$0(ActionInvocationFacetForDomainEventAbstract.java:129)
- org.apache.isis.runtime.services.xactn.TransactionServiceSpring#executeWithinTransaction(TransactionServiceSpring.java:149)
- org.apache.isis.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract#invoke(ActionInvocationFacetForDomainEventAbstract.java:128)
- org.apache.isis.metamodel.specloader.specimpl.ObjectActionDefault#executeInternal(ObjectActionDefault.java:423)
- org.apache.isis.metamodel.specloader.specimpl.ObjectActionDefault#execute(ObjectActionDefault.java:409)
- org.apache.isis.metamodel.specloader.specimpl.OneToOneAssociationContributee#get(OneToOneAssociationContributee.java:117)
- org.apache.isis.viewer.wicket.model.models.ScalarModel#setObjectFromPropertyIfVisible(ScalarModel.java:761)
- org.apache.isis.viewer.wicket.model.models.ScalarModel#access$200(ScalarModel.java:83)
- org.apache.isis.viewer.wicket.model.models.ScalarModel$Kind$1#reset(ScalarModel.java:315)
- org.apache.isis.viewer.wicket.model.models.ScalarModel$Kind$1#init(ScalarModel.java:305)
- org.apache.isis.viewer.wicket.model.models.ScalarModel#init(ScalarModel.java:729)
- org.apache.isis.viewer.wicket.model.models.ScalarModel#<init>(ScalarModel.java:724)
- org.apache.isis.viewer.wicket.model.models.EntityModel#getPropertyModel(EntityModel.java:367)
- org.apache.isis.viewer.wicket.ui.components.entity.fieldset.PropertyGroup#addPropertyToForm(PropertyGroup.java:215)
- org.apache.isis.viewer.wicket.ui.components.entity.fieldset.PropertyGroup#buildGui(PropertyGroup.java:117)
- org.apache.isis.viewer.wicket.ui.components.entity.fieldset.PropertyGroup#<init>(PropertyGroup.java:81)
we can see that 'pop' is called but there's no execution to work upon; the stack trace tells us that we're in the render phase and evaluating this contributed property (as an action) to reset the model of the rendered entity.
FWIW, with this mixin:
@Mixin(method = "prop") public class SimpleObject_search { private final SimpleObject simpleObject; public SimpleObject_search(SimpleObject simpleObject) { this.simpleObject = simpleObject; } @Action(semantics = SemanticsOf.SAFE) @Property public SimpleObject prop() { return simpleObject; } }
then everything behaves itself.
That said, we do get an interaction graph being built up in the render phase, which is odd. See ISIS-2234 for more discussion on fixing this, and also the similar ISIS-1656 which relates to auditing/publishing.