[MGNLUI-4575] ClassCastException when validating ComboBox item Created: 17/Aug/18 Updated: 26/Jun/19 Resolved: 20/Aug/18 |
|
| Status: | Closed |
| Project: | Magnolia UI |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.0 |
| Type: | Task | Priority: | Neutral |
| Reporter: | Federico Grilli | Assignee: | Federico Grilli |
| Resolution: | Not an issue | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoR: |
Empty
|
||||||||
| Epic Link: | UI framework: forms, dialogs, content editing | ||||||||
| Sprint: | Basel 154 | ||||||||
| Story Points: | 3 | ||||||||
| Description |
|
This is a follow-up issue to
The following ClassCastException occurs Caused by: java.lang.ClassCastException: Cannot cast java.lang.String to javax.jcr.Node at java.lang.Class.cast(Class.java:3369) ~[?:1.8.0_131] at com.vaadin.data.Binder$BindingBuilderImpl.lambda$createConverter$f6099586$1(Binder.java:864) ~[vaadin-server-8.4.2.jar:8.4.2] at com.vaadin.data.Converter.lambda$null$fdd4de71$1(Converter.java:105) ~[vaadin-server-8.4.2.jar:8.4.2] at com.vaadin.data.Result.of(Result.java:91) ~[vaadin-server-8.4.2.jar:8.4.2] at com.vaadin.data.Converter.lambda$from$28ca080b$1(Converter.java:105) ~[vaadin-server-8.4.2.jar:8.4.2] at com.vaadin.data.Converter$1.convertToModel(Converter.java:131) ~[vaadin-server-8.4.2.jar:8.4.2] at com.vaadin.data.Converter$2.lambda$convertToModel$5daf174e$1(Converter.java:167) ~[vaadin-server-8.4.2.jar:8.4.2] at com.vaadin.data.SimpleResult.flatMap(SimpleResult.java:66) ~[vaadin-server-8.4.2.jar:8.4.2] at com.vaadin.data.ValidationResultWrap.flatMap(ValidationResultWrap.java:66) ~[vaadin-server-8.4.2.jar:8.4.2] at com.vaadin.data.Converter$2.convertToModel(Converter.java:167) ~[vaadin-server-8.4.2.jar:8.4.2] at com.vaadin.data.Binder$BindingImpl.doConversion(Binder.java:1097) ~[vaadin-server-8.4.2.jar:8.4.2] at com.vaadin.data.Binder$BindingImpl.doValidation(Binder.java:1114) ~[vaadin-server-8.4.2.jar:8.4.2] at com.vaadin.data.Binder$BindingImpl.validate(Binder.java:1061) ~[vaadin-server-8.4.2.jar:8.4.2] at com.vaadin.data.Binder$Binding.validate(Binder.java:135) ~[vaadin-server-8.4.2.jar:8.4.2] From a first debugging session it looks something is wrong with the binding configuration. Upon selecting an item, the Vaadin's validation process kicks in and chained converters are invoked. At some point, JcrItemToLinkConverter is called and correctly converts the presentation type (JCR Node) into its model (an identifier, i.e. String). Then, other validators are called and some internal Vaadin converter expects again a Node but gets a String, hence ClassCastEx. Possibly the binding per locale implementation is messing up things due to an incomplete converter configuration? See info.magnolia.ui.framework.databinding.view.FormView as a starting point for the logic creating the Binder per Locale. |
| Comments |
| Comment by Federico Grilli [ 20/Aug/18 ] |
|
Turned out to be a wrong type in definition |