BVal
  1. BVal
  2. BVAL-66

Method validation parameter processing problems

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.1-incubating
    • Fix Version/s: 0.1-incubating
    • Component/s: None
    • Labels:
      None

      Description

      Although still experimental and although only a few tests exist for Method-level-validation, some people are already using it and are reporting problems or providing patches.
      For the old code-base (agimatec-validation, no further development going on) I got a patch that fixes some misbehavior in the MethodValidatorMetaBeanFactory.
      To provide a better way for the agimatec-validation users to migrate to apache-bval, I suggest to merge the changes into the current code base.

      see original post at: http://code.google.com/p/agimatec-validation/issues/detail?id=26

      1.
      when processAnnotation is called in MethodValidatorMetaBeanFactory
      is called the type of the class owning the method is used to process
      parameter constraints rather than the type of the parameter. This causes
      something like a @Min annotation on a parameter to generate an exception
      because no appriopriate validator class can be found for the class
      declaring the method.

      2.
      the @Valid annotation causes 'setCascaded' to be called on the
      MethodDescriptor but not on the ParameterDescriptor where it needs to be
      set. Because of this validation doesn't cascade to the parameter object.

      3.
      the @Valid is treated as being mutually exclusive from other
      constraint annotations on a parameter. It is common to use @Valid with
      @NotNull since @Valid doesn't make assumptions about the nullability of a
      value.

        Activity

        Hide
        Matt Benson added a comment -

        closing issues associated with existing releases

        Show
        Matt Benson added a comment - closing issues associated with existing releases
        Hide
        Donald Woods added a comment -

        Will be in 0.1-incubating RC3

        Show
        Donald Woods added a comment - Will be in 0.1-incubating RC3
        Hide
        Roman Stumm added a comment -

        Thanks, I committed your tests!

        Show
        Roman Stumm added a comment - Thanks, I committed your tests!
        Hide
        Carlos Vara added a comment -

        Re-uploaded patch.

        Show
        Carlos Vara added a comment - Re-uploaded patch.
        Hide
        Carlos Vara added a comment -

        Added tests for points 2 and 3. Point 1 was already fixed in apache-bval and is working fine after the merge.

        Nice to see our method validator impl getting better

        Show
        Carlos Vara added a comment - Added tests for points 2 and 3. Point 1 was already fixed in apache-bval and is working fine after the merge. Nice to see our method validator impl getting better
        Hide
        Roman Stumm added a comment -

        patch applied

        Show
        Roman Stumm added a comment - patch applied
        Hide
        Roman Stumm added a comment -

        I tried to merge the changes into the current code base, but I had to do some changes, because of other changes in the affected methods.
        All tests are still passing, but I would feel better, if some additional new tests for the patch would have also been provided..

        Show
        Roman Stumm added a comment - I tried to merge the changes into the current code base, but I had to do some changes, because of other changes in the affected methods. All tests are still passing, but I would feel better, if some additional new tests for the patch would have also been provided..

          People

          • Assignee:
            Roman Stumm
            Reporter:
            Roman Stumm
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development