-
Bug
-
Resolution: Fixed
-
Minor
-
8.0.0
-
None
-
Security Level: Jimmy
-
None
-
ZK 8.0.1
-
None
Steps to reproduce
- run a zul with the code below:
label unless="${notExistingVar}" value="Label Text"/>
actual result
java.lang.NullPointerException
at org.zkoss.zk.ui.util.ConditionImpl.isEffective(ConditionImpl.java:92)
at org.zkoss.zk.ui.metainfo.BranchInfo.isEffective(BranchInfo.java:104)
at org.zkoss.zk.ui.metainfo.ComponentInfo.isEffective(ComponentInfo.java:60)
at org.zkoss.zk.ui.impl.UiEngineImpl.isEffective(UiEngineImpl.java:1087)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:747)
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)
at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:136)
Debug information
- This issue doesn't happen in ZK 7.0.6
- The attribute if also has the same issue.
Workaround
- use shadow element with boolean operators like <if test="${notExistingVar ne null}"> instead.
- use stricter syntax like unless = $ {var ne null and var)", if the var is a boolean.
- add the property below in zk.xml
<system-property> <name>org.zkoss.zel.impl.parser.COERCE_TO_ZERO</name> <value>true</value> </system-property>
- relates to
-
ZK-2913 Specifying a non-existing variable in "test" attribute of <if> causes a NullPointerException
- Closed