Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3893

NPE with Websockets + include in defer mode

    Details

      Description

      Steps to Reproduce

      run the example with websockets enabled in zk.xml

      <zk>
      	<include id="incDefer" mode="defer" src="include1.zul"/>
      	<button label="update include src (defer) => NPE"
      			onClick='incDefer.setSrc("include2.zul")'/>
      	<include id="incInstant" src="include1.zul"/>
      	<button label="update include src (instant)"
      			onClick='incInstant.setSrc("include2.zul")'/>
      </zk>
      

      include1.zul

      <zk><div>Inc 1</div></zk>
      

      include2.zul

      <zk><div>Inc 2</div></zk>
      

      click the buttons

      Current Result

      updating the URL of an include in defer mode causes a NPE

      Failed to load /include2.zul
      
      Cause: Unknown exception: java.lang.NullPointerException.
      java.lang.NullPointerException
      	at org.eclipse.jetty.server.Dispatcher.include(Dispatcher.java:99)
      	at org.zkoss.web.servlet.Servlets.include(Servlets.java:975)
      	at org.zkoss.zk.ui.http.ExecutionImpl.include(ExecutionImpl.java:204)
      	at org.zkoss.zul.Include.include(Include.java:681)
      	at org.zkoss.zul.Include.renderProperties(Include.java:628)
      	at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:2159)
      ...
      

      Expected Result

      working include

      Workaround

      avoid defer mode with includes
      OR
      use <apply templateURI="...">
      OR
      call Executions.createComponents(...) directly

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                wenninghsu wenninghsu
                Reporter:
                cor3000 cor3000
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: