This commit makes CodecException handling consistent between functional
and annotation-based APIs. It now returns by default 4xx status code
for decoding error and 5xx for encoding error + print the error reason
in logs without the full stack trace in both variants.
Issue: SPR-15355
@ -85,7 +88,9 @@ public class DecoderHttpMessageReader<T> implements HttpMessageReader<T> {
@@ -85,7 +88,9 @@ public class DecoderHttpMessageReader<T> implements HttpMessageReader<T> {
@ -93,7 +98,9 @@ public class DecoderHttpMessageReader<T> implements HttpMessageReader<T> {
@@ -93,7 +98,9 @@ public class DecoderHttpMessageReader<T> implements HttpMessageReader<T> {
@ -101,6 +108,16 @@ public class DecoderHttpMessageReader<T> implements HttpMessageReader<T> {
@@ -101,6 +108,16 @@ public class DecoderHttpMessageReader<T> implements HttpMessageReader<T> {
@ -95,8 +97,9 @@ public class EncoderHttpMessageWriter<T> implements HttpMessageWriter<T> {
@@ -95,8 +97,9 @@ public class EncoderHttpMessageWriter<T> implements HttpMessageWriter<T> {
@ -135,6 +138,13 @@ public class EncoderHttpMessageWriter<T> implements HttpMessageWriter<T> {
@@ -135,6 +138,13 @@ public class EncoderHttpMessageWriter<T> implements HttpMessageWriter<T> {
.anyMatch(contentType::isCompatibleWith);
}
privateThrowablemapError(Throwableex){
if(exinstanceofResponseStatusException){
returnex;
}
returnnewResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR,"Failed to encode HTTP message",ex);
@ -154,7 +151,7 @@ public abstract class AbstractMessageReaderArgumentResolver extends HandlerMetho
@@ -154,7 +151,7 @@ public abstract class AbstractMessageReaderArgumentResolver extends HandlerMetho