[BLOSSOM-279] Validator configuration is not working when using validators in Blossom dialogs Created: 19/Jul/17 Updated: 27/Jan/22 |
|
| Status: | Open |
| Project: | Blossom |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Stephan Erdmann | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| 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
|
||||||||
| 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 |