You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Vojtěch Krása (JIRA)" <ji...@apache.org> on 2015/04/28 14:54:06 UTC

[jira] [Updated] (CXF-6376) Unexpected exception thrown from ResponseHandler is swallowed and status code 200 is returned

     [ https://issues.apache.org/jira/browse/CXF-6376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vojtěch Krása updated CXF-6376:
-------------------------------
    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


Such error can silently break the application:
{java}
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();
	}

}
{code}

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


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

}

```


> Unexpected exception thrown from ResponseHandler is swallowed and status code 200 is returned
> ---------------------------------------------------------------------------------------------
>
>                 Key: CXF-6376
>                 URL: https://issues.apache.org/jira/browse/CXF-6376
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.7.15
>            Reporter: Vojtěch Krása
>
> 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
> Such error can silently break the application:
> {java}
> 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();
> 	}
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)