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

ConstraintDescriptorImpl.equals does not match Annotation Proxies

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 5.1.2.Final
    • Fix Version/s: 5.1.3.Final, 5.2.0.Alpha1
    • Component/s: engine
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

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

      Description

      Class.getAnnotations() returns a Proxy object wrapping the annotation class; these objects are cached. ConstraintDescriptorImpl uses the equals() method of the annotation, but the proxy object does not implement a equals method, so Object.equals() is used.

      if ( annotation != null ? !annotation.equals( that.annotation ) : that.annotation != null ) { ... }
      

      Under high load or low memory, the cached proxy objects get cleared and newly initialized, which breaks the equals-check and the validation gets skipped.

      Annotation.annotationType() should be checked.

      This bug may be related to HV-930 Closed

      I'm still working on an unittest to show this behavior. At the moment we can reproduce it by hammering our Struts2 application with JMeter.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: