Example usage for org.springframework.http.converter HttpMessageNotReadableException toString

List of usage examples for org.springframework.http.converter HttpMessageNotReadableException toString

Introduction

In this page you can find the example usage for org.springframework.http.converter HttpMessageNotReadableException toString.

Prototype

public String toString() 

Source Link

Document

Returns a short description of this throwable.

Usage

From source file:com.orange.cepheus.cep.controller.AdminController.java

@ExceptionHandler({ HttpMessageNotReadableException.class })
public ResponseEntity<Object> messageNotReadableExceptionHandler(HttpServletRequest req,
        HttpMessageNotReadableException exception) {
    logger.error("Request not readable: {}", exception.toString());
    StatusCode statusCode = new StatusCode();
    statusCode.setCode("400");
    statusCode.setReasonPhrase(exception.getMessage());
    if (exception.getCause() != null) {
        statusCode.setDetail(exception.getCause().getMessage());
    }//from ww w.  j  av a  2s  . c om
    return new ResponseEntity<>(statusCode, HttpStatus.BAD_REQUEST);
}

From source file:com.orange.ngsi.server.NgsiBaseController.java

@ExceptionHandler({ HttpMessageNotReadableException.class })
public ResponseEntity<Object> messageNotReadableExceptionHandler(HttpServletRequest req,
        HttpMessageNotReadableException exception) {
    logger.error("Message not readable: {}", exception.toString());
    return errorResponse(req.getRequestURI(), new StatusCode(CodeEnum.CODE_400));
}