Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3022

VisitorFieldValidator default message is null

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.6
    • 2.1.8
    • None
    • None

    Description

      Validation fails when empty message is defined @VisitorFieldValidator(message=""), stack:

      java.lang.NullPointerException
      at com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:155)
      at com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:116)
      at com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:38)
      at com.opensymphony.xwork2.validator.validators.ValidatorSupport.getMessage(ValidatorSupport.java:99)
      at com.opensymphony.xwork2.validator.validators.VisitorFieldValidator.validateObject(VisitorFieldValidator.java:156)
      at com.opensymphony.xwork2.validator.validators.VisitorFieldValidator.validate(VisitorFieldValidator.java:130)
      ..

      Broken both on annotation and XML validators. Empty messages worked 2.0 but not in 2.1 (Tested up to 2.1.6).

      This is annoying on ModelDriven actions, since you can't delegate validations to model object. (empty message crashes validation and non-empty message will be appended to the actual messages of models validators).

      Attachments

        Activity

          People

            Unassigned Unassigned
            aatos Jaakko Saari
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: