Support for new JsonMappingException wording in Jackson 2.9

Issue: SPR-16947
This commit is contained in:
Juergen Hoeller
2018-06-28 16:42:35 +02:00
parent a631af80c1
commit 6d0f8bf145
2 changed files with 6 additions and 3 deletions

View File

@@ -181,8 +181,9 @@ public class MappingJackson2MessageConverter extends AbstractMessageConverter {
return; return;
} }
// Do not log warning for serializer not found (note: different message wording on Jackson 2.9)
boolean debugLevel = (cause instanceof JsonMappingException && boolean debugLevel = (cause instanceof JsonMappingException &&
cause.getMessage().startsWith("Can not find")); (cause.getMessage().startsWith("Can not find") || cause.getMessage().startsWith("Cannot find")));
if (debugLevel ? logger.isDebugEnabled() : logger.isWarnEnabled()) { if (debugLevel ? logger.isDebugEnabled() : logger.isWarnEnabled()) {
String msg = "Failed to evaluate Jackson " + (type instanceof JavaType ? "de" : "") + String msg = "Failed to evaluate Jackson " + (type instanceof JavaType ? "de" : "") +

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -65,6 +65,7 @@ import org.springframework.util.TypeUtils;
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Sebastien Deleuze * @author Sebastien Deleuze
* @since 4.1 * @since 4.1
* @see MappingJackson2HttpMessageConverter
*/ */
public abstract class AbstractJackson2HttpMessageConverter extends AbstractGenericHttpMessageConverter<Object> { public abstract class AbstractJackson2HttpMessageConverter extends AbstractGenericHttpMessageConverter<Object> {
@@ -189,8 +190,9 @@ public abstract class AbstractJackson2HttpMessageConverter extends AbstractGener
return; return;
} }
// Do not log warning for serializer not found (note: different message wording on Jackson 2.9)
boolean debugLevel = (cause instanceof JsonMappingException && boolean debugLevel = (cause instanceof JsonMappingException &&
cause.getMessage().startsWith("Can not find")); (cause.getMessage().startsWith("Can not find") || cause.getMessage().startsWith("Cannot find")));
if (debugLevel ? logger.isDebugEnabled() : logger.isWarnEnabled()) { if (debugLevel ? logger.isDebugEnabled() : logger.isWarnEnabled()) {
String msg = "Failed to evaluate Jackson " + (type instanceof JavaType ? "de" : "") + String msg = "Failed to evaluate Jackson " + (type instanceof JavaType ? "de" : "") +