org.eclipse.persistence.indirection.IndirectList

ZK-Tracker | kretes | 4 years ago
  1. 0

    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.

    ZK-Tracker | 4 years ago | kretes
    org.eclipse.persistence.indirection.IndirectList
  2. 0

    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.

    ZK-Tracker | 4 years ago | kretes
    org.eclipse.persistence.indirection.IndirectList

    Root Cause Analysis

    1. org.eclipse.persistence.indirection.IndirectList

      No message provided

      at org.zkoss.zel.impl.lang.ELSupport.coerceToTypeForSetValue()
    2. The ZK EL Library
      ValueExpressionImpl.setValue
      1. org.zkoss.zel.impl.lang.ELSupport.coerceToTypeForSetValue(ELSupport.java:468)
      2. org.zkoss.zel.impl.parser.AstValue.setValue(AstValue.java:245)
      3. org.zkoss.zel.impl.ValueExpressionImpl.setValue(ValueExpressionImpl.java:256)
      3 frames
    3. The ZKoss Common Library
      ELXelExpression.setValue
      1. org.zkoss.xel.zel.ELXelExpression.setValue(ELXelExpression.java:50)
      1 frame
    4. ZK Bind
      BinderImpl$CommandEventListener.onEvent
      1. org.zkoss.bind.impl.BindEvaluatorXImpl.setValue(BindEvaluatorXImpl.java:51)
      2. org.zkoss.bind.impl.SavePropertyBindingImpl.save(SavePropertyBindingImpl.java:128)
      3. org.zkoss.bind.impl.PropertyBindingHandler.doSaveBinding(PropertyBindingHandler.java:148)
      4. org.zkoss.bind.impl.PropertyBindingHandler.doSaveEvent(PropertyBindingHandler.java:203)
      5. org.zkoss.bind.impl.BinderImpl.doSaveEvent(BinderImpl.java:1401)
      6. org.zkoss.bind.impl.BinderImpl.access$1300(BinderImpl.java:98)
      7. org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent0(BinderImpl.java:1182)
      8. org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent(BinderImpl.java:1155)
      8 frames
    5. ZK Kernel
      Events.sendEvent
      1. org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2742)
      2. org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2713)
      3. org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2654)
      4. org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
      5. org.zkoss.zk.ui.event.Events.sendEvent(Events.java:321)
      6. org.zkoss.zk.ui.event.Events.sendEvent(Events.java:344)
      7. org.zkoss.zk.ui.event.Events.sendEvent(Events.java:351)
      7 frames
    6. our.component
      Our.setValue
      1. our.component.Our.setValue(Our.java:26)
      1 frame
    7. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:601)
      4 frames
    8. The ZK EL Library
      BeanELResolver.setValue
      1. org.zkoss.zel.BeanELResolver.setValue(BeanELResolver.java:171)
      1 frame