FasterXML / jackson-databind

General data-binding package for Jackson (2.x): works on streaming API (core) implementation(s)
Apache License 2.0
3.53k stars 1.38k forks source link

Groovy beans with boolean properties cannot be processed into json #4814

Open optyler opened 5 days ago

optyler commented 5 days ago

Hello, this issue is exactly the same as this old one

I'm experencing it with the v2.16

here is the stacktrace :

ERROR:ApiController:body():Erreur generale:org.codehaus.jackson.map.JsonMappingException: Conflicting getter definitions for property "active": com.qwam.qesapi_v2.collection.dto.CollectionDto#getActive(0 params) vs com.qwam.qesapi_v2.collection.dto.CollectionDto#isActive(0 params) (through reference chain: java.util.ArrayList[0])
org.codehaus.jackson.map.JsonMappingException: Conflicting getter definitions for property "active": com.qwam.qesapi_v2.collection.dto.CollectionDto#getActive(0 params) vs com.qwam.qesapi_v2.collection.dto.CollectionDto#isActive(0 params) (through reference chain: java.util.ArrayList[0])
    at org.codehaus.jackson.map.ser.StdSerializerProvider._createAndCacheUntypedSerializer(StdSerializerProvider.java:740)
    at org.codehaus.jackson.map.ser.StdSerializerProvider.findValueSerializer(StdSerializerProvider.java:344)
    at org.codehaus.jackson.map.ser.impl.PropertySerializerMap.findAndAddSerializer(PropertySerializerMap.java:39)
    at org.codehaus.jackson.map.ser.std.AsArraySerializerBase._findAndAddDynamic(AsArraySerializerBase.java:165)

My POGO is :

@MapConstructor
class CollectionDto {
    // ...
    String libelle
    Date date_creation

    @JsonIgnore
    long utilisateur

    boolean active = false
    // ...
}
cowtowncoder commented 5 days ago

@optyler You are using Jackson 1.x, not 2.x:

ERROR:ApiController:body():Erreur generale:org.codehaus.jackson.map.JsonMappingException: Conflicting getter definitions for property "active": com.qwam.qesapi_v2.collection.dto.CollectionDto#getActive(0 params) vs com.qwam.qesapi_v2.collection.dto.CollectionDto#isActive(0 params) (through reference chain: java.util.ArrayList[0])
org.codehaus.jackson.map.JsonMappingException:  ...

(see those org.codehaus.jackson packages?)

Going forward, issues like this need to be filed against jackson-databind, not here (jackson-core); I'll transfer.

Finally: 2.16.x is not the latest so would need to reproduce with 2.17.x or (ideally) 2.18.1.