Remove HttpStatus from HttpMessageConversionException
HttpMessageConverter's are client and server and arguably shouldn't contain a server-side concept such a response status. The status field is recent, it was added to differentiate 400 vs 500 errors with Jackson 2.9+ but there is no need for it since the same distinction is reflected in raising an HttpMessageNotReadableException vs a general HttpMessageConversionException. Issue: SPR-15516
This commit is contained in:
@@ -27,7 +27,6 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.ConversionNotSupportedException;
|
||||
import org.springframework.beans.TypeMismatchException;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.http.converter.HttpMessageNotWritableException;
|
||||
@@ -355,7 +354,7 @@ public class DefaultHandlerExceptionResolver extends AbstractHandlerExceptionRes
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("Failed to read HTTP message: " + ex);
|
||||
}
|
||||
response.sendError(ex.getErrorStatus().orElse(HttpStatus.BAD_REQUEST).value());
|
||||
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
|
||||
return new ModelAndView();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user