[MGNLUI-5478] Issue with null representation in TextFieldBinder when type is set to something else than String Created: 06/Nov/19 Updated: 04/Mar/20 Resolved: 11/Dec/19 |
|
| Status: | Closed |
| Project: | Magnolia UI |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Milan Divilek | Assignee: | Milan Divilek |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Template: |
|
||||||||||||||||||||
| 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
|
||||||||||||||||||||
| Sprint: | UI Framework 11, UI Framework 12 | ||||||||||||||||||||
| Story Points: | 2 | ||||||||||||||||||||
| Description |
salutation:
label: salutation
$type: textField
type: java.lang.Long
converterClass: com.vaadin.data.converter.StringToLongConverter
This converts text field input into Long type everything works except when field is left empty then this fails on java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number at com.vaadin.data.converter.AbstractStringToNumberConverter.convertToPresentation(AbstractStringToNumberConverter.java:40) ~[vaadin-server-8.8.5.jar:8.8.5] Problem is in info.magnolia.ui.field.TextFieldBinder where is set withNullRepresentation("") which then cause ClassCastException Instead of TextFieldBinder the info.magnolia.ui.field.factory.FieldBinder$Default could be used but that one then fails with NPE, because vaadin TextField doesn't support null value. |