Java Code Examples for com.fasterxml.jackson.core.JsonProcessingException.getOriginalMessage()

The following are Jave code examples for showing how to use getOriginalMessage() of the com.fasterxml.jackson.core.JsonProcessingException class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: OpenLRW   File: XAPIExceptionHandlerAdvice.java   View Source Code Vote up 6 votes
@ExceptionHandler(HttpMessageNotReadableException.class)
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
@ResponseBody
public XAPIErrorInfo handleHttpMessageNotReadableException(final HttpServletRequest request, HttpMessageNotReadableException e) {
    if (e.getCause() instanceof UnrecognizedPropertyException) {
        return this.handleUnrecognizedPropertyException(request, (UnrecognizedPropertyException)e.getCause());
    } else {
        XAPIErrorInfo result;
        if (e.getCause() instanceof JsonProcessingException) {
            final JsonProcessingException jpe = (JsonProcessingException)e.getCause();
            result = new XAPIErrorInfo(HttpStatus.BAD_REQUEST, request, jpe.getOriginalMessage());
        } else {
            result = new XAPIErrorInfo(HttpStatus.BAD_REQUEST, request, e);
        }
        this.logException(e);
        this.logError(result);
        return result;
    }
}
 
Example 2
Project: holon-json   File: JacksonJsonPropertyBoxProvider.java   View Source Code Vote up 5 votes
/**
 * Read a {@link PropertyBox} from JSON content, using current {@link com.holonplatform.core.Context} property set.
 * @param reader Reader
 * @return The deserialized {@link PropertyBox} instance
 * @throws IOException IO read error
 * @throws WebApplicationException JSON processing exception
 */
private PropertyBox readPropertyBox(Reader reader) throws IOException {
	try {
		return getObjectReader().readValue(reader);
	} catch (JsonProcessingException e) {
		throw new WebApplicationException(e.getOriginalMessage(), Response.status(Status.BAD_REQUEST)
				.type(MediaType.TEXT_PLAIN).entity(e.getOriginalMessage()).build());
	}
}