[ 
https://issues.apache.org/jira/browse/WINK-31?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12726327#action_12726327
 ] 

Michael Elman commented on WINK-31:
-----------------------------------

Interesting point. 

In general spec states that unchecked exceptions should be re-thrown and 
allowed to propagate to container.
Checked exception are wrapped in a container specific exception and then thrown 
and allowed to propagate to container.

However, we decided that internal Wink errors (e.g. when wink gets a checked 
exception and needs to re-throw it) should be wrapped with 
WebApplicationException in order to return "500 Internal Server Error" and log 
the exception.
So in general the policy was: "If you have to catch the checked exception and 
have nothing to do with it, re-throw it wrapped in WebApplicationException ". 
We can discuss if this policy is correct and if we want it for Wink.

IOException thrown by the provider falls into this policy, but now rethinking 
about it, I believe that it's incorrect in this special case. Especially since 
it causes MessageBodyReaders and MessageBodyWriters behave differently (the 
exception thrown by the MessageBodyWriters is not wrapped in 
WebApplicationException ). So this case is obviously a bug and I'll fix it.



> MessageBodyReader.readFrom throws IOException is turned into 
> WebApplicationException but might just need to propagate out?
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WINK-31
>                 URL: https://issues.apache.org/jira/browse/WINK-31
>             Project: Wink
>          Issue Type: Bug
>          Components: Server
>            Reporter: Bryant Luk
>            Priority: Minor
>
> In the event that a MessageBodyReader.readFrom were to throw an IOException, 
> I believe that the IOException should propagate out "untouched" (i.e. don't 
> turn it into a WebApplicationException).  This allows the error handling 
> chain (or the underlying container's error handling capabilities) to map it 
> like a IOException instead of having someone doing a getCause() on the 
> WebApplicationException.
> Around line 135 in wink-server/src/main/java 
> org.apache.wink.server.internal.registry.ServerInjectableFactory is where the 
> change would need to start to be made.
> I'm open for debate on this one since the spec is vague and unclear on this 
> behavior.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to