Uploaded image for project: 'Commons Validator'
  1. Commons Validator
  2. VALIDATOR-83

Cannot use same name for field and validator, validator is never invoked

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None
    • Operating System: other
      Platform: Other

    • 13932

    Description

      Cannot use same name for field and validator, validator is never invoked.

      The bug is in Validator.validateFieldForRule

      if (results.getValidatorResult(va.getName()) != null)

      { return isValid(results.getValidatorResult(va.getName())); }

      ValidatorResults.getValidatorResult expects a field key not the validator name.
      Here is the fix:

      if (results.getValidatorResult(field.getKey()) != null)

      { ValidatorResult result = results.getValidatorResult(field.getKey()); if (result.containsAction(va.getName())) return result.isValid(va.getName()); }

      Attachments

        Activity

          People

            Unassigned Unassigned
            padma.ginnaram@s1.com Padma Ginnaram
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: