cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "n0rad (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CXF-4496) find of ResponseExceptionMapper do not handle runtime exceptions
Date Mon, 03 Sep 2012 17:23:07 GMT
n0rad created CXF-4496:
--------------------------

             Summary: 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
            Priority: Minor


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 :

@Path("/")
public interface RestMcuBoardResource {
    @GET
    public RestMcuBoard getBoard();
}

does not work where this one work

@Path("/")
public interface RestMcuBoardResource {
    @GET
    public RestMcuBoard getBoard() throws runtimeException;
}

a fix could be :

    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; 
    }

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

Mime
View raw message