Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-217

Booking a flight for non-existent flight should result in NoSuchFlightException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0.1
    • Fix Version/s: 1.0.2
    • Component/s: Samples
    • Labels:
      None

      Description

      Submitting an invalid flight number (e.g. KL9999) bubbles up as an EmptyResultDataAccessException instead of NoSuchFlightException. This is because the JpaFlightDao uses query.getSingleResult(), which can throw a NoResultException instead of returning null. Submitting an invalid username has a similar issue.

      I've created a fix in the JPA DAO's to ensure they catch a NoResultException and re-throw it as a business exception. In the case of an invalid username I added a NoSuchUsernameException business exception.

      See attached patch for a root-level Eclipse project named 'airline' created with 'mvn eclipse:eclipse' from the samples directory and connected to the Spring-WS SVN repository.

      1. airline.patch
        19 kB
        Rossen Stoyanchev

        Activity

        Hide
        rstoya05-aop Rossen Stoyanchev added a comment -

        Attaching eclipse patch file.

        Show
        rstoya05-aop Rossen Stoyanchev added a comment - Attaching eclipse patch file.
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Fixed.

        Rather than throwing a business exception at the DAO level (which introduces a cyclic dependency between service and dao layer), all DAOs now return null when an object is not found.

        Show
        arjen.poutsma Arjen Poutsma added a comment - Fixed. Rather than throwing a business exception at the DAO level (which introduces a cyclic dependency between service and dao layer), all DAOs now return null when an object is not found.
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Closing 1.0.2 issues.

        Show
        arjen.poutsma Arjen Poutsma added a comment - Closing 1.0.2 issues.

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            rstoya05-aop Rossen Stoyanchev
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: