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

Unexpected behavior multi threads accessing ConstraintValidatorManager

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.1.2.Final
    • Fix Version/s: 5.4.1.Final, 6.0.0.Alpha1
    • Component/s: engine
    • Labels:
      None
    • Environment:
      tomcat 6.0.45
      JDK 1.7.0_97
      Debian GNU/Linux 8 (jessie)

      Description

      Initializing the validation context, invoking the validator, so the validation process works fine and iterate on each constraint normally.
      But when more than one thread is doing that same time, the same exact case execution inside org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorManager.getInitializedValidator, executes if ( constraintValidatorCache.containsKey( key ) ) and evaluates to TRUE, while the constraintValidator is NULL, so the method actually return null.
      Then ConstraintTree.getConstraintValidatorNoUnwrapping, execute throwExceptionForNullValidator.

      This happen randomly for different fields and then we have a not valid exception message as No validator could be found for constraint 'XXXXXXXXX' validating type 'java.lang.String'. Check configuration for 'XXXXXXXX', while though the validator of this annotation actually accepts String validation

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: