Hi Gabo I'm wondering, how I can reproduce it... I have two exception mappers in the system tests area, the first one catching an application exception, the second one a spring security exception.
I've tried updating the status code in [1] from 500 to 401 and saw a test [3] failing. Can you help me to reproduce the issue you're seeing ? A very simple test case would be handy... thanks, Sergey [1] http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookExceptionMapper.java [2] http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecurityExceptionMapper.java [3] http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java Gabo Manuel wrote: > > Hi Sergey, > > I am expecting it to handle RuntimeException from the code and from the > framework. So far, my test includes both from the method and that of no > resource mapping to the url provided, e.g. "/Service/nonexistent" > instead of "/Service/operation" > > Thanks. > > Gabo > > Sergey Beryozkin wrote: >> Hi Gabo >> >> Is the original RuntimeException thrown from the application code ? >> Just would like to figure out how to do a test, I don't remember JAXRS >> runtime setting 203... >> >> cheers, Sergey >> >> >> Gabo Manuel wrote: >> >>> Hi All, >>> >>> I created and registered an ExceptionMapper implementation as follows: >>> >>> public class RuntimeExceptionMapper implements >>> ExceptionMapper<RuntimeException>{ >>> private static Logger logger = >>> Logger.getLogger(RuntimeExceptionMapper.class); >>> >>> public Response toResponse(RuntimeException fault) { >>> logger.fatal("Bug encountered",fault); >>> >>> StringBuffer sb = new StringBuffer(); >>> sb.append("Add some fancy buffer message here for client to >>> see."); >>> >>> ResponseBuilder rb = Response.status(500); >>> rb.type(MediaType.TEXT_PLAIN); >>> rb.entity(sb.toString()); >>> >>> // notify people here.. >>> // return rb.build(); >>> WebApplicationException ex = new >>> WebApplicationException(rb.build()); >>> ex.setStackTrace(null); >>> throw ex; >>> } >>> } >>> >>> In 2.2.2 I used the "return rb.build();" and got pretty much what I >>> expected. However, upgrading to 2.2.3 the http status I get is 203 >>> instead of the specified 500. >>> >>> Throwing an exception causes the status to be 500 but the message is not >>> included in the body. Also, there are times that I would want the status >>> to be 400 but with the exception, the status is fixed at 500. >>> >>> Please advise. >>> >>> Gabo >>> >>> >>> >>> >> >> >> ------------------------------------------------------------------------ >> >> >> No virus found in this incoming message. >> Checked by AVG - www.avg.com >> Version: 8.5.392 / Virus Database: 270.13.45/2287 - Release Date: >> 08/07/09 06:22:00 >> >> > > -- View this message in context: http://www.nabble.com/-CXF2.2.3--On-exception-handling-tp24859798p24918194.html Sent from the cxf-user mailing list archive at Nabble.com.
