org.eclipse.persistence.indirection.IndirectList

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Having an entity with: List someList = new ArrayList<>(); and a form in zul: form="@id('detail') @init(vm.form) @load(vm.entity) @save(vm.entity before='save')" where vm.entity returns entity fetched from DB. and having a binding : value="@load(vm.modifiedList) @save(detail.someList)"/> with method on ViewModel: public List getModifiedList() { return new ArrayList(); } the code is failing on first run with existing entity with an exception: {code} Cannot convert [Object[3]] of type class java.util.ArrayList to class org.eclipse.persistence.indirection.IndirectList at org.zkoss.zel.impl.lang.ELSupport.coerceToTypeForSetValue(ELSupport.java:468) at org.zkoss.zel.impl.parser.AstValue.setValue(AstValue.java:245) at org.zkoss.zel.impl.ValueExpressionImpl.setValue(ValueExpressionImpl.java:256) at org.zkoss.xel.zel.ELXelExpression.setValue(ELXelExpression.java:50) at org.zkoss.bind.impl.BindEvaluatorXImpl.setValue(BindEvaluatorXImpl.java:51) at org.zkoss.bind.impl.SavePropertyBindingImpl.save(SavePropertyBindingImpl.java:128) at org.zkoss.bind.impl.PropertyBindingHandler.doSaveBinding(PropertyBindingHandler.java:148) at org.zkoss.bind.impl.PropertyBindingHandler.doSaveEvent(PropertyBindingHandler.java:203) at org.zkoss.bind.impl.BinderImpl.doSaveEvent(BinderImpl.java:1401) at org.zkoss.bind.impl.BinderImpl.access$1300(BinderImpl.java:98) at org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent0(BinderImpl.java:1182) at org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent(BinderImpl.java:1155) at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2742) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2713) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2654) at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) at org.zkoss.zk.ui.event.Events.sendEvent(Events.java:321) at org.zkoss.zk.ui.event.Events.sendEvent(Events.java:344) at org.zkoss.zk.ui.event.Events.sendEvent(Events.java:351) at our.component.Our.setValue(Our.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.zkoss.zel.BeanELResolver.setValue(BeanELResolver.java:171) ... 83 more {code} This is a general misconception that what is binded must be of the same class as original value. ZK should look at the declaration of the method/property for binding, not the type of actual value. Since everything is declared as 'List' it should accept any type of List, without trying to cast to some subtype. PS. I tried adding a converter, but that didn't change anything. I had the same error.
    via by kretes,
  • Having an entity with: List someList = new ArrayList<>(); and a form in zul: form="@id('detail') @init(vm.form) @load(vm.entity) @save(vm.entity before='save')" where vm.entity returns entity fetched from DB. and having a binding : value="@load(vm.modifiedList) @save(detail.someList)"/> with method on ViewModel: public List getModifiedList() { return new ArrayList(); } the code is failing on first run with existing entity with an exception: {code} Cannot convert [Object[3]] of type class java.util.ArrayList to class org.eclipse.persistence.indirection.IndirectList at org.zkoss.zel.impl.lang.ELSupport.coerceToTypeForSetValue(ELSupport.java:468) at org.zkoss.zel.impl.parser.AstValue.setValue(AstValue.java:245) at org.zkoss.zel.impl.ValueExpressionImpl.setValue(ValueExpressionImpl.java:256) at org.zkoss.xel.zel.ELXelExpression.setValue(ELXelExpression.java:50) at org.zkoss.bind.impl.BindEvaluatorXImpl.setValue(BindEvaluatorXImpl.java:51) at org.zkoss.bind.impl.SavePropertyBindingImpl.save(SavePropertyBindingImpl.java:128) at org.zkoss.bind.impl.PropertyBindingHandler.doSaveBinding(PropertyBindingHandler.java:148) at org.zkoss.bind.impl.PropertyBindingHandler.doSaveEvent(PropertyBindingHandler.java:203) at org.zkoss.bind.impl.BinderImpl.doSaveEvent(BinderImpl.java:1401) at org.zkoss.bind.impl.BinderImpl.access$1300(BinderImpl.java:98) at org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent0(BinderImpl.java:1182) at org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent(BinderImpl.java:1155) at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2742) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2713) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2654) at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) at org.zkoss.zk.ui.event.Events.sendEvent(Events.java:321) at org.zkoss.zk.ui.event.Events.sendEvent(Events.java:344) at org.zkoss.zk.ui.event.Events.sendEvent(Events.java:351) at our.component.Our.setValue(Our.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.zkoss.zel.BeanELResolver.setValue(BeanELResolver.java:171) ... 83 more {code} This is a general misconception that what is binded must be of the same class as original value. ZK should look at the declaration of the method/property for binding, not the type of actual value. Since everything is declared as 'List' it should accept any type of List, without trying to cast to some subtype. PS. I tried adding a converter, but that didn't change anything. I had the same error.
    via by kretes,
    • org.eclipse.persistence.indirection.IndirectList at org.zkoss.zel.impl.lang.ELSupport.coerceToTypeForSetValue(ELSupport.java:468) at org.zkoss.zel.impl.parser.AstValue.setValue(AstValue.java:245) at org.zkoss.zel.impl.ValueExpressionImpl.setValue(ValueExpressionImpl.java:256) at org.zkoss.xel.zel.ELXelExpression.setValue(ELXelExpression.java:50) at org.zkoss.bind.impl.BindEvaluatorXImpl.setValue(BindEvaluatorXImpl.java:51) at org.zkoss.bind.impl.SavePropertyBindingImpl.save(SavePropertyBindingImpl.java:128) at org.zkoss.bind.impl.PropertyBindingHandler.doSaveBinding(PropertyBindingHandler.java:148) at org.zkoss.bind.impl.PropertyBindingHandler.doSaveEvent(PropertyBindingHandler.java:203) at org.zkoss.bind.impl.BinderImpl.doSaveEvent(BinderImpl.java:1401) at org.zkoss.bind.impl.BinderImpl.access$1300(BinderImpl.java:98) at org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent0(BinderImpl.java:1182) at org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent(BinderImpl.java:1155) at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2742) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2713) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2654) at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) at org.zkoss.zk.ui.event.Events.sendEvent(Events.java:321) at org.zkoss.zk.ui.event.Events.sendEvent(Events.java:344) at org.zkoss.zk.ui.event.Events.sendEvent(Events.java:351) at our.component.Our.setValue(Our.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.zkoss.zel.BeanELResolver.setValue(BeanELResolver.java:171)
    No Bugmate found.