Issue Details (XML | Word | Printable)

Key: JAX_RS_SPEC-284
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Santiago Pericas-Geertsen
Reporter: mkarg
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
jax-rs-spec

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

Created: 23/Oct/12 07:45 PM   Updated: 18/Jun/13 12:38 PM   Resolved: 05/Nov/12 03:50 PM
Component/s: filters&handlers
Affects Version/s: 2.0
Fix Version/s: 2.0

Time Tracking:
Not Specified

Environment:

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


Tags:
Participants: Marek Potociar, mkarg and Santiago Pericas-Geertsen


 Description  « Hide

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?



Santiago Pericas-Geertsen added a comment - 05/Nov/12 03:50 PM

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.


mkarg added a comment - 06/Nov/12 07:08 PM

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())?


Marek Potociar added a comment - 07/Nov/12 11:38 AM

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...


mkarg added a comment - 07/Nov/12 06:06 PM

Understood! Thanks for the explanation.