Details
-
Bug
-
Resolution: Fixed
-
Neutral
-
6.2.4
-
None
-
Empty show more show less
-
Yes
-
Yes
-
UI FW 27, UI FW 28
-
5
Description
Currently the default value type in ValueBoundProperty is bound with the presentation type of the field (generic <T>), but it is typically something else (i.e. the model type).
E.g. presentation value of the JCR selects is the Node but the default value is specified as a string.
Symptoms
The problem is most prominent when there is a converter between the model and the presentation types is preset. E.g. this:
field: $type: textField type: java.lang.Long converterClass: com.vaadin.data.converter.StringToLongConverter defaultValue: !!java.lang.Long 0
In the snippet above will cause a CCE for the following reasons:
- SnakeYAML will read the number as hinted by the tag
- Map2Bean will resolve the generic default value type (via getter/setter signature and BeanIntrospection)
- M2B will consequently convert a number to a string and will feed it to the converter chain upon field initialisation, converter will fail.
Solution:
- Be explicit about the type of the default value (by implementing
MGNLUI-6374)? - Be more flexible when setting the default value? I.e. in FormPresenter - do not assume that the value is in "model" form, check if the value is already compatible with presentation form. Consider adding presetation type as [pre-configured] definition property? Do we have a use-case for model type property as well?
Checklists
Attachments
Issue Links
- depends upon
-
MGNLUI-6374 Allow to configure the default value resolution strategy in FieldDefinition
-
- Closed
-
- is causing
-
MGNLFORM-336 Boolean fields set with String as defaultValue
-
- Closed
-
- supersedes
-
MGNLUI-6603 defaultValue for preconfigured link fields doesn't work (page,json,damLinkField)
-
- Closed
-
-
MGNLUI-6755 defaultValue in TextField with type Long doesn't work
-
- Closed
-
- to be documented by
-
MGNLUI-6713 DOC: Update class hierarchy for select fields
-
- Closed
-