Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-15839

SpringValidatorAdapter fails to retrieve value for Bean Validation 2.0's "<list element>" literal

    Details

      Description

      It seems like SpringValidatorAdapter doesn't handle <list element> literal. It is sometimes expected, as far as I understand JSR 380 spec correctly. Please, review http://beanvalidation.org/2.0/spec/2.0.0.cr3/#valueextractordefinition-builtinvalueextractors and correct me if I'm wrong. Note <iterable element>, <map key> and <map value> too.

      I hope that "Reference URL" contains SSCCE. Will keep it for some time. I've attached all interesting files just in case something goes wrong.

      As you (will be able to) see, validator.validate(bean, errors) ends up with IllegalStateException. I would expect one field error instead.

      One more thing: I believe it's not about "bean property versus direct field access". Getters and setters are here. To be sure, I checked not only BeanPropertyBindingResult but DirectFieldBindingResult too. Same result.

      1. MyBean.java
        0.3 kB
        Michał Sobkiewicz
      2. MyConfiguration.java
        0.4 kB
        Michał Sobkiewicz
      3. MyTest.java
        0.9 kB
        Michał Sobkiewicz
      4. pom.xml
        2 kB
        Michał Sobkiewicz

        Issue Links

          Activity

          Hide
          perceptron8 Michał Sobkiewicz added a comment -

          How about few additional tests for <map key> and <map value>? If you like, feel free grab them from: https://github.com/perceptron8/spr-13482/blob/master/src/test/java/SpringValidatorAdapterTests.java.

          Show
          perceptron8 Michał Sobkiewicz added a comment - How about few additional tests for <map key> and <map value> ? If you like, feel free grab them from: https://github.com/perceptron8/spr-13482/blob/master/src/test/java/SpringValidatorAdapterTests.java .

            People

            • Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              perceptron8 Michał Sobkiewicz
              Last updater:
              Stéphane Nicoll
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                6 weeks, 3 days ago