|
|
|
@ -466,7 +466,7 @@ public abstract class ResponseEntityExceptionHandler implements MessageSourceAwa |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Customize the handling of {@link TypeMismatchException}. |
|
|
|
* Customize the handling of {@link TypeMismatchException}. |
|
|
|
* <p>By default this method creates a {@link ProblemDetail} with the status |
|
|
|
* <p>By default, this method creates a {@link ProblemDetail} with the status |
|
|
|
* and a short detail message, and also looks up an override for the detail |
|
|
|
* and a short detail message, and also looks up an override for the detail |
|
|
|
* via {@link MessageSource}, before delegating to |
|
|
|
* via {@link MessageSource}, before delegating to |
|
|
|
* {@link #handleExceptionInternal}. |
|
|
|
* {@link #handleExceptionInternal}. |
|
|
|
@ -480,7 +480,8 @@ public abstract class ResponseEntityExceptionHandler implements MessageSourceAwa |
|
|
|
protected @Nullable ResponseEntity<Object> handleTypeMismatch( |
|
|
|
protected @Nullable ResponseEntity<Object> handleTypeMismatch( |
|
|
|
TypeMismatchException ex, HttpHeaders headers, HttpStatusCode status, WebRequest request) { |
|
|
|
TypeMismatchException ex, HttpHeaders headers, HttpStatusCode status, WebRequest request) { |
|
|
|
|
|
|
|
|
|
|
|
Object[] args = {ex.getPropertyName(), ex.getValue()}; |
|
|
|
Object[] args = {ex.getPropertyName(), ex.getValue(), |
|
|
|
|
|
|
|
(ex.getRequiredType() != null ? ex.getRequiredType().getSimpleName() : "")}; |
|
|
|
String defaultDetail = "Failed to convert '" + args[0] + "' with value: '" + args[1] + "'"; |
|
|
|
String defaultDetail = "Failed to convert '" + args[0] + "' with value: '" + args[1] + "'"; |
|
|
|
String messageCode = ErrorResponse.getDefaultDetailMessageCode(TypeMismatchException.class, null); |
|
|
|
String messageCode = ErrorResponse.getDefaultDetailMessageCode(TypeMismatchException.class, null); |
|
|
|
ProblemDetail body = createProblemDetail(ex, status, defaultDetail, messageCode, args, request); |
|
|
|
ProblemDetail body = createProblemDetail(ex, status, defaultDetail, messageCode, args, request); |
|
|
|
|