Debug-level log entry for any Jackson exception during canConvert

Issue: SPR-15582
This commit is contained in:
Juergen Hoeller
2017-06-07 17:56:47 +02:00
parent 8330134757
commit be93ee77e4
2 changed files with 25 additions and 5 deletions

View File

@@ -191,10 +191,20 @@ public abstract class AbstractJackson2HttpMessageConverter extends AbstractGener
* @since 4.3
*/
protected void logWarningIfNecessary(Type type, Throwable cause) {
if (cause != null && !(cause instanceof JsonMappingException && cause.getMessage().startsWith("Can not find"))) {
if (cause == null) {
return;
}
boolean debugLevel = (cause instanceof JsonMappingException &&
cause.getMessage().startsWith("Can not find"));
if (debugLevel ? logger.isDebugEnabled() : logger.isWarnEnabled()) {
String msg = "Failed to evaluate Jackson " + (type instanceof JavaType ? "de" : "") +
"serialization for type [" + type + "]";
if (logger.isDebugEnabled()) {
if (debugLevel) {
logger.debug(msg, cause);
}
else if (logger.isDebugEnabled()) {
logger.warn(msg, cause);
}
else {