jax-rs-spec
  1. jax-rs-spec
  2. JAX_RS_SPEC-284

Specification should say what happens if "filter()" throws an exception

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: filters&handlers
    • Labels:
      None
    • Environment:

      Jersey 2.0 M08-1, JAX-RS 2.0 M12, JRE 1.7.0_07

      Description

      The specification does not say what will happen if a filter() method throws an exception: Will this stop the chain (hence the request, with propagation of exception to exception handler and container), or is this exception silently ignored?

        Activity

        Hide
        Santiago Pericas-Geertsen added a comment -

        Section 6.7 in the spec is specifically about exceptions in filters and interceptors. I suspect this issue may have filed on an earlier version of the spec.

        Show
        Santiago Pericas-Geertsen added a comment - Section 6.7 in the spec is specifically about exceptions in filters and interceptors. I suspect this issue may have filed on an earlier version of the spec.
        Hide
        mkarg added a comment -

        You are right, the spec tells what to do when filter() throws an exception. I simply missed chapter 6.7! Sorry.

        On the other hand, what happens if filter() inlines a FilterStream instance using setEntityOutputStream() and that FilterStream instance throws an Exception in writer() for example? Is chapter 6.7 meant to cover this case, too (as that exception will happen after then end of filter())?

        Show
        mkarg added a comment - You are right, the spec tells what to do when filter() throws an exception. I simply missed chapter 6.7! Sorry. On the other hand, what happens if filter() inlines a FilterStream instance using setEntityOutputStream() and that FilterStream instance throws an Exception in writer() for example? Is chapter 6.7 meant to cover this case, too (as that exception will happen after then end of filter())?
        Hide
        Marek Potociar added a comment -

        Exceptions are handled based on the component from which they are thrown. Anything else does not make sense IMO. It does not matter that the exception has been caused by a filter action earlier. Similar exceptions could have been caused by application logic too and that does not mean we would treat those exceptions as if they were not thrown from the writer...

        Show
        Marek Potociar added a comment - Exceptions are handled based on the component from which they are thrown. Anything else does not make sense IMO. It does not matter that the exception has been caused by a filter action earlier. Similar exceptions could have been caused by application logic too and that does not mean we would treat those exceptions as if they were not thrown from the writer...
        Hide
        mkarg added a comment -

        Understood! Thanks for the explanation.

        Show
        mkarg added a comment - Understood! Thanks for the explanation.

          People

          • Assignee:
            Santiago Pericas-Geertsen
            Reporter:
            mkarg
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: