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

Specifying a non-existing variable in "test" attribute of <if> causes a NullPointerException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Normal Normal
    • 8.0.1
    • 8.0.0
    • None
    • Security Level: Jimmy
    • None
    • None

      steps to reproduce

      1. run the code below
        <if test="${notExistingVar}">
            <label value="Label Text"/>
        </if>
        

      actual result

      java.lang.NullPointerException
      at org.zkoss.zuti.zul.If$1.setValue(If.java:57)
      at org.zkoss.zuti.zul.If$1.setValue(If.java:55)
      at org.zkoss.zk.ui.metainfo.Property.assign0(Property.java:203)
      at org.zkoss.zk.ui.metainfo.Property.assign(Property.java:171)
      at org.zkoss.zk.ui.metainfo.ShadowInfo.apply(ShadowInfo.java:112)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:835)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:807)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:709)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:923)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:877)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:748)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:822)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:771)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:709)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:452)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:358)
      at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:217)

      workaround

      • <if test="${notExistingVar eq null}">

            jumperchen jumperchen
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: