BVal
  1. BVal
  2. BVAL-25

When validating a bean whose getter throws a RTE, it must be wrapped in a ValidationException

    Details

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

      Description

      To fix this, I did some cleaning in the way exceptions are handled

      • Created UnknownPropertyException, which extends ValidationException, to easily route that case and translate it to an IllegalArgumentException at top level method exit.
      • All RTE thrown by getters in the validated beans will be wrapped in a ValidationException.
      • Changed method unrecoverableValidationError(..) to build exceptions instead of throwing them.
      • Created a set of tests that verify that the methods in ClassValidator honor the exception contract in the spec.

      3 more tests pass.

      1. ExceptionHandling.patch
        2 kB
        Carlos Vara
      2. ExceptionsContractTest.java
        7 kB
        Carlos Vara
      3. UnknownPropertyException.java
        1 kB
        Carlos Vara

        Activity

        Carlos Vara created issue -
        Carlos Vara made changes -
        Field Original Value New Value
        Attachment ExceptionsContractTest.java [ 12442680 ]
        Attachment UnknownPropertyException.java [ 12442681 ]
        Attachment ExceptionHandling.patch [ 12442682 ]
        Roman Stumm made changes -
        Assignee Roman Stumm [ romanstumm ]
        Roman Stumm made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Roman Stumm made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Matt Benson made changes -
        Fix Version/s 0.2-incubating [ 12314850 ]
        Matt Benson made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development