Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
-
None
Description
If a validator is configured for a field inside a Blossom dialog, a template error occurs when the dialog gets loaded for editing. The dialog cannot be opened.
The cause for this error is the getValidatorName() method in the class
info.magnolia.ui.form.validator.definition.FieldValidatorDefinitionKeyGenerator
In line 45 the getName() method of the ConfiguredFieldValidatorDefinition instance is called. This returns null for a validator configured with Blossom. When null is passed to the of method of Optional, a NullPointerException is thrown:
return definition instanceof ConfiguredFieldValidatorDefinition? Optional.of(((ConfiguredFieldValidatorDefinition)definition).getName()):Optional.empty();
Example code:
@TabFactory("Content") public void contentTab(UiConfig cfg, TabBuilder tab, DialogCreationContext context) throws InvalidPathException { tab.fields( cfg.fields.text("items").label("Number of items").defaultValue("10").validator(cfg.validators.digitsOnly())); }
This bug is related to an already existing open issue in #BLOSSOM-245
Checklists
Acceptance criteria
Attachments
Issue Links
- depends upon
-
BLOSSOM-290 Enable UI 6 definition usage in dialog/tab factories
-
- Closed
-