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

Reply via email to