Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-5478

Issue with null representation in TextFieldBinder when type is set to something else than String

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 6.2
    • None
    • None
    • None
    • UI Framework 11, UI Framework 12
    • 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.

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                mdivilek Milan Divilek
                mdivilek Milan Divilek
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD