Skip to content

Commit 003d643

Browse files
committed
Consistent support for new JsonMappingException wording in Jackson 2.9
Issue: SPR-16947
1 parent e4666c1 commit 003d643

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
* <li>{@link DeserializationFeature#FAIL_ON_UNKNOWN_PROPERTIES} is disabled</li>
5555
* </ul>
5656
*
57-
* <p>Compatible with Jackson 2.6 and higher, as of Spring 4.3.
57+
* <p>Compatible with Jackson 2.9 and higher, as of Spring 5.1.
5858
*
5959
* @author Rossen Stoyanchev
6060
* @author Juergen Hoeller
@@ -181,8 +181,8 @@ protected void logWarningIfNecessary(Type type, @Nullable Throwable cause) {
181181
return;
182182
}
183183

184-
boolean debugLevel = (cause instanceof JsonMappingException &&
185-
cause.getMessage().startsWith("Can not find"));
184+
// Do not log warning for serializer not found (note: different message wording on Jackson 2.9)
185+
boolean debugLevel = (cause instanceof JsonMappingException && cause.getMessage().startsWith("Cannot find"));
186186

187187
if (debugLevel ? logger.isDebugEnabled() : logger.isWarnEnabled()) {
188188
String msg = "Failed to evaluate Jackson " + (type instanceof JavaType ? "de" : "") +

spring-web/src/main/java/org/springframework/http/converter/json/AbstractJackson2HttpMessageConverter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -65,6 +65,7 @@
6565
* @author Juergen Hoeller
6666
* @author Sebastien Deleuze
6767
* @since 4.1
68+
* @see MappingJackson2HttpMessageConverter
6869
*/
6970
public abstract class AbstractJackson2HttpMessageConverter extends AbstractGenericHttpMessageConverter<Object> {
7071

@@ -189,8 +190,8 @@ protected void logWarningIfNecessary(Type type, @Nullable Throwable cause) {
189190
return;
190191
}
191192

192-
boolean debugLevel = (cause instanceof JsonMappingException &&
193-
(cause.getMessage().startsWith("Can not find") || cause.getMessage().startsWith("Cannot find")));
193+
// Do not log warning for serializer not found (note: different message wording on Jackson 2.9)
194+
boolean debugLevel = (cause instanceof JsonMappingException && cause.getMessage().startsWith("Cannot find"));
194195

195196
if (debugLevel ? logger.isDebugEnabled() : logger.isWarnEnabled()) {
196197
String msg = "Failed to evaluate Jackson " + (type instanceof JavaType ? "de" : "") +

0 commit comments

Comments
 (0)