-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ArrayListMultimapDeserializer
does not support multimaps inside another object as a property
#104
Comments
oh, should move to the jackson-datatypes-collections repo. |
It sounds like there may be a problem to solve. But we would need a full reproduction: looks like this might be using polymorphic deserialization, for example. Description alone is not necessarily sufficient to see how to trigger the problem. |
em, here is an example:
it will throw a |
Ok thank you @magical-l . |
ArrayListMultimapDeserializer
does not support multimaps inside another object as a property
@magical-l Did you actually test this against later versions? I cannot reproduce it with 2.14.2. This is pretty much the first thing one should do before reporting bugs. :-( |
@cowtowncoder |
@cowtowncoder
then the exception will happen at the same place(
|
Ok. I'll have a look :) |
Ok, yes, I can reproduce the issue. I was able to add a failing test; hoping to look into what gives tomorrow. |
Ok this is weird: serialization of polymorphic value seems completely wrong... type id should not be written as property as that won't work with |
One work-around, fwtw: use |
Ok. Think I found the fix... and also learned something about polymorphic serialization of |
Fixed in 2.14 for 2.14.3; now empty Multimaps can be written, read as polymorphic values too. |
CN: (guava module)
ArrayListMultimapDeserializer
未支持multimap作为其他对象的属性。EN: (guava module)
ArrayListMultimapDeserializer
does not support multimaps inside another object as a propertyCN: 在
com.fasterxml.jackson.datatype.guava.deser.multimap.GuavaMultimapDeserializer:209
行(deserializeFromSingleValue(JsonParser p, DeserializationContext ctxt)
方法中),我们将会检查p.getCurrentToken()
是否为JsonToken.START_OBJECT
。EN: at
com.fasterxml.jackson.datatype.guava.deser.multimap.GuavaMultimapDeserializer:209
(inside the methoddeserializeFromSingleValue(JsonParser p, DeserializationContext ctxt)
), we will check whether the value ofp.getCurrentToken()
isJsonToken.START_OBJECT
.若multimap作为json的整体,此时p.getCurrentToken()确实是JsonToken.START_OBJECT。
if we are deserialize the whole json object to a multimap, then
p.getCurrentToken()
is exactlyJsonToken.START_OBJECT
.但若multimap作为另一个对象的属性,如下:
but what if the multimap is a property of another object:
此时p.getCurrentToken()将是JsonToken.FIELD_NAME,对应其作为另一对象属性的属性名
theMultimapProperty
。then now the value of
p.getCurrentToken()
would beJsonToken.FIELD_NAME
, as the property name for the multimap in the outside objecttheMultimapProperty
.然后解析失败。
and then the deserialization fails.
jackson version: 2.13.4
The text was updated successfully, but these errors were encountered: