]
Jeff Mesnil updated WFCORE-3651:
--------------------------------
Fix Version/s: (was: 4.0.0.CR1)
ParameterCorrector are not taken into account by XML parser
-----------------------------------------------------------
Key: WFCORE-3651
URL:
https://issues.jboss.org/browse/WFCORE-3651
Project: WildFly Core
Issue Type: Bug
Components: Domain Management
Affects Versions: 4.0.0.Beta2
Reporter: Jeff Mesnil
Assignee: Jeff Mesnil
The ParameterCorrector of an AttributeDefinition must attempt to correct the value before
the value is validated against the AttributeDefinition's ParameterValidator.
This works fine when DMR operations are executed against the server.
However, this fails when XML is parsed as the XML parser is validating the value without
correcting it first.
I encounter this issue in WFLY-9706 when the validator constrains to use only -1 instead
of any negative value.
If I had a ParameterCorrect that correct any negative values (e.g. -3) to -1, the XML
parser fails because the value (-3) is not valid (must be -1).
Using :write-attribute works fine as the ParameterCorrect will correct -3 to -1 before it
is validated.
The simple short term fix is to call the ParameterCorrect when the XML parser read the
attribute before it validates its value.
However this duplicates code that is already done in AttributeDefinition.validateAndSet.
We could handle all this logic (correction/validation) only when the DMR operations are
executed.
However doing so would make it impossible to report informative XML errors as the user
would have to find how the faulty DMR op map to the XML file he provided.
So keeping this logic of correction/validation when XML is parsed is useful for error
reporting but it should delegate to some methods of AttributeDefinition instead of
duplicating the code (and missing some cases such as parameter correction)