Skip to content

Commit 6d0f8bf

Browse files
committed
Support for new JsonMappingException wording in Jackson 2.9
Issue: SPR-16947
1 parent a631af8 commit 6d0f8bf

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,9 @@ protected void logWarningIfNecessary(Type type, @Nullable Throwable cause) {
181181
return;
182182
}
183183

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

187188
if (debugLevel ? logger.isDebugEnabled() : logger.isWarnEnabled()) {
188189
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 & 2 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,9 @@ protected void logWarningIfNecessary(Type type, @Nullable Throwable cause) {
189190
return;
190191
}
191192

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

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

0 commit comments

Comments
 (0)