You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2012/09/28 13:03:07 UTC
[jira] [Resolved] (CXF-4496) find of ResponseExceptionMapper do not
handle runtime exceptions
[ https://issues.apache.org/jira/browse/CXF-4496?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergey Beryozkin resolved CXF-4496.
-----------------------------------
Resolution: Fixed
Fix Version/s: 2.7.0
2.6.3
Assignee: Sergey Beryozkin
in CXF 2.6.3 it is ServerWebApplicationException and in 2.7.0: WebApplicationException. ResponseExceptionMapper<WebApplicationException> will work in 2.6.3 and 2.7.0, and similarly - RuntimeException catch block will be executed
> find of ResponseExceptionMapper do not handle runtime exceptions
> ----------------------------------------------------------------
>
> Key: CXF-4496
> URL: https://issues.apache.org/jira/browse/CXF-4496
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 2.6.2
> Reporter: n0rad
> Assignee: Sergey Beryozkin
> Priority: Minor
> Fix For: 2.6.3, 2.7.0
>
>
> In org.apache.cxf.jaxrs.client.ClientProxyImpl.findExceptionMapper(Method, Message)
> The responseExceptionMapper is selected based on exception defined in the resource method signature but this method may have thrown a RuntimeException :
> {code:java}
> @Path("/")
> public interface RestMcuBoardResource {
> @GET
> public RestMcuBoard getBoard();
> }
> {code}
> does not work where this one work
> {code:java}
> @Path("/")
> public interface RestMcuBoardResource {
> @GET
> public RestMcuBoard getBoard() throws runtimeException;
> }
> {code}
> a fix could be :
> {code:java}
> private static ResponseExceptionMapper<?> findExceptionMapper(Method m, Message message) {
> ProviderFactory pf = ProviderFactory.getInstance(message);
> for (Class<?> exType : m.getExceptionTypes()) {
> ResponseExceptionMapper<?> mapper = pf.createResponseExceptionMapper(exType);
> if (mapper != null) {
> return mapper;
> }
> }
> + return pf.createResponseExceptionMapper(RuntimeException.class);
> - return null;
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira