Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6376

Unexpected exception thrown from ResponseHandler is swallowed and status code 200 is returned

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.7.15
    • Fix Version/s: 2.7.16
    • Component/s: JAX-RS
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      quickstart: https://github.com/krasa/cxf-bug
      mvn jetty:run
      GET http://localhost:8080/cxf/rest/foo
      -> 200 is returned, while the log prints javax.ws.rs.NotFoundException, but no mention about the exception which occured inside the ResponseHandler

      Such error can silently break the application:

      import javax.ws.rs.core.Response;
      
      import org.apache.cxf.jaxrs.ext.ResponseHandler;
      import org.apache.cxf.jaxrs.model.OperationResourceInfo;
      import org.apache.cxf.message.Message;
      
      public class ErrorResponseHandler implements ResponseHandler {
      
      	@Override
      	public Response handleResponse(Message m, OperationResourceInfo ori, Response response) {
      		System.out.println("throwing NPE");
      		throw new NullPointerException();
      	}
      
      }
      

        Attachments

          Activity

            People

            • Assignee:
              sergey_beryozkin Sergey Beryozkin
              Reporter:
              meo Vojtěch Krása
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: