[MGNLUI-2915] Runtime Exception when trying to convert an Enum to a String Created: 20/May/14 Updated: 09/Mar/21 Resolved: 09/Mar/21 |
|
| Status: | Closed |
| Project: | Magnolia UI |
| Component/s: | forms |
| Affects Version/s: | 5.2.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Federico Grilli | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Template: |
|
| Patch included: |
Yes
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
| Description |
|
Vaadin does not provide one StringToEnumConvert by default so this is what one gets when trying to display an Enum property in a text field. Caused by: com.vaadin.data.util.converter.Converter$ConversionException: Unable to convert value of type info.magnolia.task.Task$Status to presentation type class java.lang.String. No converter is set and the types are not compatible. at com.vaadin.data.util.converter.ConverterUtil.convertFromModel(ConverterUtil.java:116) at com.vaadin.ui.Label.getDataSourceValue(Label.java:187) at com.vaadin.ui.Label.setPropertyDataSource(Label.java:260) at info.magnolia.ui.form.field.factory.AbstractFieldFactory.getView(AbstractFieldFactory.java:205) at info.magnolia.ui.dialog.formdialog.FormBuilder.buildView(FormBuilder.java:135) The fix consists in creating a simple Converter and add a check in AbstractFieldFactory.getView(..) (see attached patch) |