You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this case, there's no information about the array index in which the error is originating, since the path only has 1 node (it should have two like below).
In other situations we do, for example:
"{ \"array\": [ true, 1 ]}"
public class Foo {
public List<Boolean> array;
}
1: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot coerce Number (1) for type `java.lang.Boolean` (enable `MapperFeature.ALLOW_COERCION_OF_SCALARS` to allow)
at [Source: (PushbackInputStream); line: 2, column: 27] (through reference chain: Foo["array"]->java.util.ArrayList[1])
2: Foo["array"]
3: array
4: -1
2: java.util.ArrayList[1]
3: null
4: 1
Is there something different when using custom deserializers?
The text was updated successfully, but these errors were encountered:
No, location tracking should work the same way... but it is possible that something in deserializer for List<Object> is different from that of more specialized List<String> (internally there is optimized handler for second case).
So it sounds like a bug. Thank you for reporting this!
cowtowncoder
changed the title
Array index missing in path of JsonMappingException
Array index missing in path of JsonMappingException for Collection<String>, with custom deserializer
Sep 30, 2019
Ok so... deserializers do need to add try-catch block to include location information, and this was missing from one code path of StringCollectionDeserializer. I added handling, but do not have a good unit test; would be nice to have, but for now location information can be seen from sample given. Fix will be in 2.10.1.
In some situations the path of a
JsonMappingException
doesn't contain the array index where the error occurred.In the following example we have a custom string deserializer which is disabling the automatic casting from other types (#796).
In this case, there's no information about the array index in which the error is originating, since the path only has 1 node (it should have two like below).
In other situations we do, for example:
Is there something different when using custom deserializers?
The text was updated successfully, but these errors were encountered: