question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Conflicting setter definitions for property" exception for `Map` subtype during deserialization

See original GitHub issue

I’ve been deserializing Spring’s HttpHeaders without issue until I upgraded to latests Spring 2.3.0 which upgraded Jackson from 2.10.3 to 2.11.

After the upgrade to Jackson 2.11 I get this exception when trying to deserialize an HttpHeaders object:

com.fasterxml.jackson.databind.JsonMappingException: Conflicting setter definitions for property "date": org.springframework.http.HttpHeaders#setDate(1 params) vs org.springframework.http.HttpHeaders#setDate(1 params)

(same can happen for lastModified or any other overloaded setter)

There are 3 setDate methods on HttpHeaders.

It’s throw as part of POJOPropertyBuilder#getSetter()

I’ve traced it back to this change in POJOPropertiesCollector as part of #2555

I couldn’t find any way to disable indexing. #2555 is hinting that there isn’t one:

It may become necessary to allow NOT doing this, too (via MapperFeature), but let’s start by assumption that index should be used.

I’m wondering if the indexing change broke backward compatibility.

Version exhibiting behavior: 2.11 Last working version (that I tried): 2.10.4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:17 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
bratwurztcommented, Mar 18, 2022

This bug is back on v2.12.6:

java.lang.IllegalArgumentException: Conflicting setter definitions for property "expires": org.springframework.http.HttpHeaders#setExpires(java.time.ZonedDateTime) vs org.springframework.http.HttpHeaders#setExpires(java.time.Instant)
	at com.fasterxml.jackson.databind.introspect.POJOPropertyBuilder.getSetter(POJOPropertyBuilder.java:512) ~[jackson-databind-2.12.6.jar:2.12.6]
	at io.swagger.v3.core.jackson.ModelResolver.ignore(ModelResolver.java:1006) ~[swagger-core-2.1.12.jar:2.1.12]
	at io.swagger.v3.core.jackson.ModelResolver.resolve(ModelResolver.java:575) ~[swagger-core-2.1.12.jar:2.1.12]
	at org.springdoc.core.converters.AdditionalModelsConverter.resolve(AdditionalModelsConverter.java:123) ~[springdoc-openapi-common-1.6.6.jar:1.6.6]
0reactions
cowtowncodercommented, Mar 19, 2022

@bratwurzt this may look similar but it is probably not exactly the same as the regression test added with the fix (MapDeser2757Test) still passes. What’d be needed is a new reproduction (failing unit test) and new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to overcome "Conflicting setter definitions for property "?
Simply use this annotation on the deserialization setter method to indicate Jackson wich one to use: @com.fasterxml.jackson.annotation.
Read more >
Uses of Class com.fasterxml.jackson.databind.cfg.MapperConfig
Package that contains interfaces that define how to implement functionality for dynamically resolving type during deserialization.
Read more >
SUSE alert SUSE-SU-2022:1678-1 (jackson-databind ...
readTree()' + IllegalArgumentException: Conflicting setter definitions for property with more than 2 setters + Serializing java.lang.
Read more >
Security update for jackson-databind, jackson-dataformats ...
... + "Conflicting setter definitions for property" exception for 'Map' subtype during deserialization + Fail to deserialize local Records + ...
Read more >
Definitive Guide to Jackson ObjectMapper - Serialize and ...
Whenever there's a mismatch between the names of properties/fields in a JSON String and a POJO - you can deal with the mismatch...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found