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

Switch between tabs causes NullPointerException

    Details

    • Type: Bug
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: 7.0.3
    • Fix Version/s: None
    • Component/s: ZK Update Engine
    • Labels:
      None
    • Environment:

      ZK 7.0.3 CE (build: 2014090212)
      Windows 7
      Tomcat v7.0

      Description

      Hello,

      I am using a tabbox with mvvm (see example zul), to group editable parameters for a stored process that can be started via web ui.

      When I edit a textbox inside a tabpanel and immediately click on another tab (without leaving the textbox first), I get a NullPointerException (stracktrace included).
      The reason seems to be that the Tab component receives an AuRequest that does not include the selected Tab. Furthermore, the Tab does not have access to its _parent (via AbstractComponent), which is null in this case.

      I tried to circumvent the issue by adding a before-expression in the textbox definition (see example zul), but it has no effect.

      Is there a way to solve this issue without changing the ZK sourcecode?

      Many thanks in advance,
      Johannes

      Example 1:
      {{ <tabbox id="mainTabbox" vflex="1" height="100%"
      visible="@load(vm.paramGridIsVisible)" orient="bottom">
      <tabs id="subTabs"
      children="@bind(vm.paramGroupTab) @template('pgrouptemplate')"
      width="200px">
      <template name="pgrouptemplate" var="pgroup">
      <tab label="@load(pgroup.name)"
      selected="@load(vm.pickedItem eq pgroup)"
      onSelect="@command('onParamGroupTabSelect',item=pgroup)"
      tooltiptext="@load(pgroup.footnote)" />
      </template>
      </tabs>
      <tabpanels id="subTabpanels" vflex="1"
      children="@bind(vm.paramGroupTab) @template('pgrouppaneltemplate')">
      <template name="pgrouppaneltemplate" var="pgroup">
      <tabpanel>
      <borderlayout style="background:white">
      <center border="none" autoscroll="true">
      <grid vflex="1"
      model="@load(pgroup.params) @template( each.paramName eq 'separator'?'spacertemplate':each.templateName)">
      <columns>
      <column hflex="1"
      label="$

      {labels.lblParamName}

      " />
      <column hflex="2"
      label="$

      {labels.lblParamValue}

      " />
      </columns>
      <template name="textboxtemplate"
      var="visibleParam">
      <row
      tooltiptext="@load(visibleParam.paramHelpText)">
      <label
      value="@load(visibleParam.paramName)" />
      <cell>
      <textbox hflex="1"
      value="@load(visibleParam.displayValue) @save(visibleParam.paramValue, before=

      {'onStartClick','onParamGroupTabSelect'}

      )"
      constraint="$

      {w:newParamInputConstraint(visibleParam)}

      "
      disabled="@load(visibleParam.isReadOnly)"
      onChange="@command('onChangeParam',param=visibleParam)"
      focus="@bind(visibleParam.selected)" />
      </cell>
      </row>
      </template>
      <!-- more template definitions, omitted for brevity -->
      </grid>
      </center>
      <south border="none">
      <checkbox
      label="$

      {labels.lblParamSaveUserSettings}

      "
      visible="@load(pgroup.saveUserSettingsIsVisible)"
      checked="@load(pgroup.saveUserSettingsIsChecked)"
      onCheck="@command('onCheckSaveUserSettings',group=pgroup, checked=self.checked)" />
      </south>
      </borderlayout>
      </tabpanel>
      </template>
      </tabpanels>
      </tabbox>
      }}

      Stacktrace:
      {{Mai 03, 2017 10:43:27 AM org.zkoss.zk.ui.impl.UiEngineImpl handleError
      SCHWERWIEGEND:
      java.lang.NullPointerException
      at org.zkoss.zul.Tab.service(Tab.java:404)
      at org.zkoss.zk.ui.impl.DesktopImpl.service(DesktopImpl.java:710)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1249)
      at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:603)
      at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:485)
      at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:494)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      }}

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            jlang jlang
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: