|
@@ -126,8 +126,12 @@ public class GlobalExceptionInterceptor extends AbstractErrorController implemen
|
|
if (ObjectUtils.isEmpty(errors)) {
|
|
if (ObjectUtils.isEmpty(errors)) {
|
|
return Collections.emptyMap();
|
|
return Collections.emptyMap();
|
|
}
|
|
}
|
|
- return errors.stream().collect(Collectors.toMap(FieldError::getField,
|
|
|
|
- e -> ObjectUtils.ifNull(e.getDefaultMessage(), StringUtils.EMPTY), (o, n) -> n));
|
|
|
|
|
|
+ return errors.stream().collect(Collectors.toMap(FieldError::getField, e -> {
|
|
|
|
+ if (Objects.isNull(e.getDefaultMessage()) || e.contains(TypeMismatchException.class)) {
|
|
|
|
+ return ApplicationContextHolder.getMessage("Parameter.Invalid");
|
|
|
|
+ }
|
|
|
|
+ return e.getDefaultMessage();
|
|
|
|
+ }, (o, n) -> n));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -141,8 +145,9 @@ public class GlobalExceptionInterceptor extends AbstractErrorController implemen
|
|
if (ObjectUtils.isEmpty(references)) {
|
|
if (ObjectUtils.isEmpty(references)) {
|
|
return Collections.emptyMap();
|
|
return Collections.emptyMap();
|
|
}
|
|
}
|
|
|
|
+ String message = ApplicationContextHolder.getMessage("Parameter.Invalid");
|
|
return references.stream().collect(Collectors.toMap(
|
|
return references.stream().collect(Collectors.toMap(
|
|
- JsonMappingException.Reference::getFieldName, r -> "Invalid value"
|
|
|
|
|
|
+ JsonMappingException.Reference::getFieldName, r -> message, (o, n) -> n
|
|
));
|
|
));
|
|
}
|
|
}
|
|
|
|
|