Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects versions: 5.2.1.Final
    • Fix versions: 5.2.3.Final, 5.3.0.Alpha1
    • Components: validators
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

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

      Description

      Function PathImpl.createCopy(PathImpl path) creates new PathImpl that has hashCode==0. This value is fixed and never changes (due to the algorithm in hascode() funcion). The correct value after copying should have been -1 or the same value as in the source object.

      The problematic PathImpl with the zero hashCode is unfortunately returned from the validate() function:

      Set<ConstraintViolation<MyBean>> constraintViolations = validator.validate(myBean );
      System.out.println(constraintViolations.iterator().next().getPropertyPath().hashCode());
      // -- always 0 (provided the set is not empty, of course)
      

      Test:

      PathImpl p = PathImpl.createPathFromString("just.testing");
      System.out.println(p.hashCode());
      PathImpl pBad = PathImpl.createCopy(p1);
      System.out.println(pBad.hashCode());   // ----- returns always 0
      

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: