Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1364

Incorrect status code when failed to parse some @*Param value

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • 4.0.0.CR1
    • 3.0.16.Final, 3.6.2.Final
    • jaxrs
    • None

    Description

      When RESTEasy gets an exception while converting resource method argument annotated with some @Param annotation, it should return either 400 or 404 depending on which annotation is used. Instead, it currently always rethrows exception wrapped in BadRequestException, which always results in 400. (Unless exception is already WebApplicationException.)

      See specification section "3.2 Fields and Bean Properties":

      A WebApplicationException thrown during construction of field or property values using any of the
      5 steps listed above is processed directly as described in Section 3.3.4. Other exceptions thrown during
      construction of field or property values using any of the 5 steps listed above are treated as client errors: if the
      field or property is annotated with @MatrixParam , @QueryParam or @PathParam then an implementation MUST generate an instance of NotFoundException (404 status) that wraps the thrown exception and no
      entity; if the field or property is annotated with @HeaderParam or @CookieParam then an implementation
      MUST generate an instance of BadRequestException (400 status) that wraps the thrown exception and
      no entity.

      Although this section mentions fields and bean properties, it also applies to resource methods as stated in "3.3.2 Parameters":

      Exceptions thrown during construction of parameter values are treated the same as exceptions thrown during construction of field or bean property values, see Section 3.2.

      Bonus points:
      Furthermore, it would be really nice if said exception was first subject to exception mapping, if there's an ExceptionMapper defined for it.

      Attachments

        Issue Links

          Activity

            People

              rsearls r searls
              koscejev Anton Koščejev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: