Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-3651

ParameterCorrector are not taken into account by XML parser

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 4.0.0.Beta2
    • Management
    • None

      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)

            jmesnil1@redhat.com Jeff Mesnil
            jmesnil1@redhat.com Jeff Mesnil
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: