Uploaded image for project: 'Hibernate Validator'
  1. HV-986

ConstraintValidatorContext buildConstraintViolationWithTemplate not reading message string

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects versions: 5.1.3.Final
    • Fix versions: None
    • Components: validators
    • Labels:
    • Environment:
      Windows 8.1 Pro
      Gradle project
      Spring 4.1.4
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      buildConstraintViolationWithTemplate('some message') does not work.

      context.disableDefaultConstraintViolation();
      context.buildConstraintViolationWithTemplate("{customConstraint.duplicateName}")
              .addConstraintViolation();
      

      the above code will output whatever is defined in the default message.

      context.disableDefaultConstraintViolation();
      context.buildConstraintViolationWithTemplate("{customConstraint.duplicateName}")
              .addPropertyNode(null).inIterable().atKey(field)
              .addPropertyNode("name")
              .addConstraintViolation();
      

      the above code will ignore the message and default message and will out put the code with the fiull path and the name of the constraint prepended.

      I wrote up a stackoverflow question here with more detail :

      http://stackoverflow.com/questions/29519433/constraintvalidatorcontext-not-sending-messages

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: