Struts 2
  1. Struts 2
  2. WW-3022

VisitorFieldValidator default message is null

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.6
    • Fix Version/s: 2.1.8
    • Component/s: None
    • Labels:
      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).

        Activity

        Hide
        Wes Wannemacher added a comment -

        This seems a bit of a fringe case... I mean, why wouldn't you have a message? I'm marking for version 2.2.x and as an improvement as I am not following the use-case.

        Show
        Wes Wannemacher added a comment - This seems a bit of a fringe case... I mean, why wouldn't you have a message? I'm marking for version 2.2.x and as an improvement as I am not following the use-case.
        Hide
        musachy added a comment -

        this was fixed already in xwork

        Show
        musachy added a comment - this was fixed already in xwork

          People

          • Assignee:
            Unassigned
            Reporter:
            Jaakko Saari
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development