Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-2384

Action that takes a List of view models fails to gather them when object has been viewed already

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0-M3
    • 2.0.0-M4
    • Demo App
    • None

    Description

      From demo in master, apply this patch:

      diff --git a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/StatefulViewModelJaxbRefsEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/StatefulViewModelJaxbRefsEntity.java
      index 92a26bc..476ca60 100644
      --- a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/StatefulViewModelJaxbRefsEntity.java
      +++ b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/StatefulViewModelJaxbRefsEntity.java
      @@ -37,11 +37,10 @@
       import org.apache.isis.applib.annotation.Property;
       import org.apache.isis.applib.annotation.SemanticsOf;
       
      +import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
       import lombok.Getter;
       import lombok.Setter;
       
      -import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
      -
       //tag::class[]
       @XmlRootElement(name = "demo.StatefulViewModelJaxbRefsEntity")
       @XmlType(
      @@ -103,6 +102,14 @@
           @XmlElement(name = "child")
           private List<ChildJdoEntity> children = new ArrayList<>();
       
      +    @Action(associateWith = "children")
      +    public StatefulViewModelJaxbRefsEntity suffixChildren(List<ChildJdoEntity> children) {
      +    	for(ChildJdoEntity child : children) {
      +    		child.setName(child.getName() + ", Jr");
      +    	}
      +    	return this;
      +    }
      +    
           @Action(associateWith = "children", associateWithSequence = "1", semantics = SemanticsOf.NON_IDEMPOTENT)
           public StatefulViewModelJaxbRefsEntity addChild(final ChildJdoEntity child) {
               children.add(child);
      
      

      Then, on the demo wicket page, go to the view models refs entity.  Add all children.  Then view all children individually (I used ctrl-click). 

       

      Then, select all the children and run the "Suffix Children" action.  Before being prompted to affirm the selected children, an NPE occurs:

                                          
                                              java.lang.NullPointerException
                                          
                                              
                                          
                                                  java.util.Objects#requireNonNull(Objects.java:222)
      
                                          
                                                  
      org.apache.isis.viewer.wicket.ui.components.widgets.linkandlabel.LinkAndLabelFactoryAbstract$1#doOnClick(LinkAndLabelFactoryAbstract.java:112)
      
                                          
                                                  org.apache.isis.viewer.wicket.ui.components.widgets.linkandlabel.ActionLink#onClick(ActionLink.java:100)
      
                                          
                                                  org.apache.wicket.ajax.markup.html.AjaxLink$1#onEvent(AjaxLink.java:85)
      
                                          
                                                  org.apache.wicket.ajax.AjaxEventBehavior#respond(AjaxEventBehavior.java:127)
      
                                          
                                                  org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#onRequest(AbstractDefaultAjaxBehavior.java:598)
      
                                          
                                                  org.apache.wicket.core.request.handler.ListenerRequestHandler#internalInvoke(ListenerRequestHandler.java:306)
      
                                          
                                                  org.apache.wicket.core.request.handler.ListenerRequestHandler#invoke(ListenerRequestHandler.java:280)
      
                                          
                                                  org.apache.wicket.core.request.handler.ListenerRequestHandler#invokeListener(ListenerRequestHandler.java:222)
      
                                          
                                                  org.apache.wicket.core.request.handler.ListenerRequestHandler#respond(ListenerRequestHandler.java:208)
      
                                          
                                                  org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor#respond(RequestCycle.java:914)
      
                                          
                                                  org.apache.wicket.request.RequestHandlerExecutor#execute(RequestHandlerExecutor.java:65)
      
                                          
                                                  org.apache.wicket.request.cycle.RequestCycle#execute(RequestCycle.java:282)
      
                                          
                                                  org.apache.wicket.request.cycle.RequestCycle#processRequest(RequestCycle.java:253)
      
                                          
                                                  org.apache.wicket.request.cycle.RequestCycle#processRequestAndDetach(RequestCycle.java:221)
      
                                          
                                                  org.apache.wicket.protocol.http.WicketFilter#processRequestCycle(WicketFilter.java:275)
      
                                          
                                                  org.apache.wicket.protocol.http.WicketFilter#processRequest(WicketFilter.java:206)
      
                                          
                                                  org.apache.wicket.protocol.http.WicketFilter#doFilter(WicketFilter.java:299)
      
                                          
                                                  org.apache.catalina.core.ApplicationFilterChain#internalDoFilter(ApplicationFilterChain.java:193)
      
                                          
                                                  org.apache.catalina.core.ApplicationFilterChain#doFilter(ApplicationFilterChain.java:166)
      
                                          
                                                  org.apache.isis.core.webapp.modules.logonlog.IsisLogOnExceptionFilter#doFilter(IsisLogOnExceptionFilter.java:60)
      
                                          
                                                  org.apache.catalina.core.ApplicationFilterChain#internalDoFilter(ApplicationFilterChain.java:193)
      
                                          
                                                  org.apache.catalina.core.ApplicationFilterChain#doFilter(ApplicationFilterChain.java:166)
      
                                          
                                                  org.springframework.web.filter.RequestContextFilter#doFilterInternal(RequestContextFilter.java:100)
      
                                          
                                                  org.springframework.web.filter.OncePerRequestFilter#doFilter(OncePerRequestFilter.java:119)
      
                                          
                                                  org.apache.catalina.core.ApplicationFilterChain#internalDoFilter(ApplicationFilterChain.java:193)
      
                                          
                                                  org.apache.catalina.core.ApplicationFilterChain#doFilter(ApplicationFilterChain.java:166)
      
                                          
                                                  org.springframework.web.filter.FormContentFilter#doFilterInternal(FormContentFilter.java:93)
      
                                          
                                                  org.springframework.web.filter.OncePerRequestFilter#doFilter(OncePerRequestFilter.java:119)
      
                                          
                                                  org.apache.catalina.core.ApplicationFilterChain#internalDoFilter(ApplicationFilterChain.java:193)
      
                                          
                                                  org.apache.catalina.core.ApplicationFilterChain#doFilter(ApplicationFilterChain.java:166)
      
                                          
                                                  org.springframework.web.filter.CharacterEncodingFilter#doFilterInternal(CharacterEncodingFilter.java:201)
      
                                          
                                                  org.springframework.web.filter.OncePerRequestFilter#doFilter(OncePerRequestFilter.java:119)
      
                                          
                                                  org.apache.catalina.core.ApplicationFilterChain#internalDoFilter(ApplicationFilterChain.java:193)
      
                                          
                                                  org.apache.catalina.core.ApplicationFilterChain#doFilter(ApplicationFilterChain.java:166)
      
                                          
                                                  org.apache.shiro.web.servlet.AbstractShiroFilter#executeChain(AbstractShiroFilter.java:449)
      
                                          
                                                  org.apache.shiro.web.servlet.AbstractShiroFilter$1#call(AbstractShiroFilter.java:365)
      
                                          
                                                  org.apache.shiro.subject.support.SubjectCallable#doCall(SubjectCallable.java:90)
      
                                          
                                                  org.apache.shiro.subject.support.SubjectCallable#call(SubjectCallable.java:83)
      
                                          
                                                  org.apache.shiro.subject.support.DelegatingSubject#execute(DelegatingSubject.java:387)
      
                                          
                                                  org.apache.shiro.web.servlet.AbstractShiroFilter#doFilterInternal(AbstractShiroFilter.java:362)
      
                                          
                                                  org.apache.shiro.web.servlet.OncePerRequestFilter#doFilter(OncePerRequestFilter.java:125)
      
                                          
                                                  org.apache.catalina.core.ApplicationFilterChain#internalDoFilter(ApplicationFilterChain.java:193)
      
                                          
                                                  org.apache.catalina.core.ApplicationFilterChain#doFilter(ApplicationFilterChain.java:166)
      
                                          
                                                  org.apache.catalina.core.StandardWrapperValve#invoke(StandardWrapperValve.java:202)
      
                                          
                                                  org.apache.catalina.core.StandardContextValve#invoke(StandardContextValve.java:96)
      
                                          
                                                  org.apache.catalina.authenticator.AuthenticatorBase#invoke(AuthenticatorBase.java:541)
      
                                          
                                                  org.apache.catalina.core.StandardHostValve#invoke(StandardHostValve.java:139)
      
                                          
                                                  org.apache.catalina.valves.ErrorReportValve#invoke(ErrorReportValve.java:92)
      
                                          
                                                  org.apache.catalina.core.StandardEngineValve#invoke(StandardEngineValve.java:74)
      
                                          
                                                  org.apache.catalina.connector.CoyoteAdapter#service(CoyoteAdapter.java:343)
      
                                          
                                                  org.apache.coyote.http11.Http11Processor#service(Http11Processor.java:373)
      
                                          
                                                  org.apache.coyote.AbstractProcessorLight#process(AbstractProcessorLight.java:65)
      
                                          
                                                  org.apache.coyote.AbstractProtocol$ConnectionHandler#process(AbstractProtocol.java:868)
      
                                          
                                                  org.apache.tomcat.util.net.NioEndpoint$SocketProcessor#doRun(NioEndpoint.java:1590)
      
                                          
                                                  org.apache.tomcat.util.net.SocketProcessorBase#run(SocketProcessorBase.java:49)
      
                                          
                                                  java.util.concurrent.ThreadPoolExecutor#runWorker(ThreadPoolExecutor.java:1128)
      
                                          
                                                  java.util.concurrent.ThreadPoolExecutor$Worker#run(ThreadPoolExecutor.java:628)
      
                                          
                                                  org.apache.tomcat.util.threads.TaskThread$WrappingRunnable#run(TaskThread.java:61)
      
                                          
                                                  java.lang.Thread#run(Thread.java:830)
      
                                          
                                      

       

      Note, this action succeeds if I do not view the children beforehand.

       

       

      Attachments

        Activity

          People

            hobrom Andi Huber
            bkalbfus Brian Kalbfus
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: