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

background component creation resulting in NPE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 9.0.0
    • 6.0.0, 8.6.2
    • ZK Update Engine
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      Run the zul file below, wait 2 seconds.

      <div apply="BackgroundComponentCreation"/>
      

      Current Result

      NPE:

      Caused by: java.lang.NullPointerException
      	at org.zkoss.zk.ui.http.ExecutionImpl.getAttribute(ExecutionImpl.java:488)
      	at org.zkoss.zk.ui.impl.Utils.getComponentInfos(Utils.java:117)
      	at org.zkoss.zk.ui.impl.Utils.setComponentInfo(Utils.java:129)
      	at org.zkoss.zk.ui.impl.AbstractUiFactory.newComponent(AbstractUiFactory.java:137)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:918)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:888)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:775)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:739)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.createComponents(UiEngineImpl.java:1142)
      	at org.zkoss.zk.ui.impl.AbstractExecution.createComponentsDirectly(AbstractExecution.java:389)
      	at org.zkoss.zk.ui.Executions.createComponentsDirectly(Executions.java:413)
      

      Expected Result

      working component creation or meaningful error

      Debug Info

      this used to work up to ZK 5.0.13

      Root Cause

      the Execution implementation CCExecution (dedicated to component creation outside an active execution) fails when calling getAttribute/setAttribute

      Workaround

      The attached composer contains a prototypic implementation of CCExecution (commented out), when using it the error doesn't occur and the created components can be appended to a parent component

            rudyhuang rudyhuang
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Remaining Estimate - 1 day
                1d
                Logged:
                Time Spent - Not Specified
                Not Specified