Skip to content

Parsing embedded array field order gets messed up when decoding #260

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

Open
notzippy opened this issue Mar 16, 2020 · 0 comments
Open

Parsing embedded array field order gets messed up when decoding #260

notzippy opened this issue Mar 16, 2020 · 0 comments

Comments

@notzippy
Copy link

For object with an array list of objects with more then one item in the array like {"a":[{"c":"12","d":12},{"c":"12","d":12}]} the following exception occurs. If the array is reduced to 1 length of one value it is successful, if it is mapped as Any[] it works as well. In the following case the nested object had a UUID field and a datetime field, and the order got swapped.

Exception in thread "main" java.lang.IllegalArgumentException: Can not set java.util.Date field Event.datetime to java.util.UUID
	at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
	at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
	at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:58)
	at java.base/jdk.internal.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36)
	at java.base/java.lang.reflect.Field.get(Field.java:418)
	at com.jsoniter.ReflectionObjectDecoder.decodeBinding(ReflectionObjectDecoder.java:382)
	at com.jsoniter.ReflectionObjectDecoder.access$700(ReflectionObjectDecoder.java:10)
	at com.jsoniter.ReflectionObjectDecoder$OnlyField.decode_(ReflectionObjectDecoder.java:153)
	at com.jsoniter.ReflectionObjectDecoder$OnlyField.decode(ReflectionObjectDecoder.java:119)
	at com.jsoniter.ReflectionArrayDecoder.decode(ReflectionArrayDecoder.java:35)
	at com.jsoniter.ReflectionObjectDecoder.decodeBinding(ReflectionObjectDecoder.java:376)
	at com.jsoniter.ReflectionObjectDecoder.decodeBinding(ReflectionObjectDecoder.java:384)
	at com.jsoniter.ReflectionObjectDecoder.access$700(ReflectionObjectDecoder.java:10)
	at com.jsoniter.ReflectionObjectDecoder$OnlyField.decode_(ReflectionObjectDecoder.java:164)
	at com.jsoniter.ReflectionObjectDecoder$OnlyField.decode(ReflectionObjectDecoder.java:119)
	at com.jsoniter.JsonIterator.read(JsonIterator.java:385)
	at com.jsoniter.JsonIterator.read(JsonIterator.java:375)
	at com.jsoniter.JsonIterator.deserialize(JsonIterator.java:441)
	at com.jsoniter.JsonIterator.deserialize(JsonIterator.java:404)
	at happy.main(happy.java:55)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant