-
Bug
-
Resolution: Fixed
-
Major
-
8.5.0
-
Security Level: Jimmy
-
None
-
happens with both ZK CE (zkbind.jar) or ZK EE (zkmax.jar)
-
ZK 8.5.2 S1, ZK 8.5.2 S2
-
None
Steps to Reproduce
run the attached simplified example
Current Result
the EL @load(vm.status eq Status_ZK3828.OK) in combination with a @DependsOn("message") at getStatus causes the following Exception
-> indicating a problem during @DependsOn tracking
org.zkoss.zel.PropertyNotFoundException: No public static field named [message] was found on class [zk.support.bugs.Status_ZK3828] at org.zkoss.zel.StaticFieldELResolver.getValue(StaticFieldELResolver.java:66) at org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:66) at org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:66) at org.zkoss.xel.zel.XelELResolver.getValue(XelELResolver.java:99) at org.zkoss.bind.xel.zel.BindELResolver.getValue(BindELResolver.java:121) at org.zkoss.zel.impl.parser.AstValue.getValue(AstValue.java:188) at org.zkoss.zel.impl.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184) at org.zkoss.zkmax.bind.impl.ValueExpressionImplEx.getValue(ValueExpressionImplEx.java:52) at org.zkoss.xel.zel.ELXelExpression.evaluate(ELXelExpression.java:41) at org.zkoss.zkmax.bind.impl.BindEvaluatorXImplEx$LazyBindXelExpression.evaluate(BindEvaluatorXImplEx.java:124) at org.zkoss.bind.impl.BindEvaluatorXImpl.getValue(BindEvaluatorXImpl.java:46) at org.zkoss.bind.xel.zel.BindELContext.addDependsOnTracking(BindELContext.java:354) at org.zkoss.bind.xel.zel.BindELContext.addDependsOnTracking(BindELContext.java:330) at org.zkoss.bind.impl.LoadPropertyBindingImpl.addDependsOnTrackings(LoadPropertyBindingImpl.java:144) at org.zkoss.bind.xel.zel.BindELContext.addDependsOnTrackings(BindELContext.java:301) at org.zkoss.bind.xel.zel.BindELResolver.tieValue(BindELResolver.java:331) at org.zkoss.zkmax.bind.impl.BindELResolverEx.tieValue(BindELResolverEx.java:143) ...
Expected Result
no exception
Workaround
use alternative EL expressions:
<!-- workaround 1 reversing the order: enum first works --> <label value="@load(Status_ZK3828.OK eq vm.status)"/> <!-- workaround 2 compare against enum string value --> <label value="@load(vm.status eq 'OK')"/>
replace @DependsOn with @NotifyChange
// workaround 3 use @NotifyChange instead of @DependsOn @NotifyChange("status") public void setMessage(String message) { this.message = message; } // workaround 3 use @NotifyChange instead of @DependsOn // @DependsOn("message") public Status_ZK3828 getStatus() { return getMessage().contains("error") ? Status_ZK3828.ERROR : Status_ZK3828.OK; }