Ejemplo n.º 1
0
 @Ignore
 @ExceptionHandler(value = HttpMessageNotReadableException.class)
 public @ResponseBody ResponseEntity<String> catchHttpMessageNotReadableException(
     HttpMessageNotReadableException exception) {
   LOGGER.error("REST Wrong Input Body Exception: " + exception.getMessage(), exception);
   return JsonRestUtils.toJsonResponse(
       HttpStatus.BAD_REQUEST, new ErrorResponse(BUSINESS_ERROR_CODE, exception.getMessage()));
 }
 /** Thrown by HttpMessageConverter implementations when the read method fails.. */
 @ExceptionHandler(HttpMessageNotReadableException.class)
 public ResponseEntity<Map<String, Object>> handleHttpMessageNotReadableException(
     HttpMessageNotReadableException error) {
   Map<String, Object> errorMap = new HashMap<String, Object>();
   errorMap.put("hasErrors", "true");
   errorMap.put(
       "developerMessage",
       "Error parsing  Json request to corresponding object."
           + " please form the correct JSON String ");
   errorMap.put("userMessage", "");
   errorMap.put("moreInfo", error.getMessage());
   errorMap.put("errorCode", HttpStatus.BAD_REQUEST);
   error.printStackTrace();
   return new ResponseEntity<Map<String, Object>>(errorMap, HttpStatus.BAD_GATEWAY);
 }