Gson rounds extreme Long values

Description

It seems JSON serialization through GSON ends up rounding Long values. Most of the times it goes unoticed, unfortunately, but in some cases we can end up with errors (especially with ES 7.16) as the rounding will take the value out of the allowed range, e.g. for longs:

-9.223372036854776E18 is less than Long.MIN_VALUE, which is -9223372036854775808.

Activity

Show:

Yoann Rodière December 8, 2021 at 1:45 PM

Apparently GSON is not at fault here. The serialized JSON is just fine, but Elasticsearch 7.16 converts longs to doubles internally for some reason; I need to investigate that.

Closing this ticket.

Rejected

Details

Assignee

Reporter

Priority

Created December 8, 2021 at 1:32 PM
Updated December 8, 2021 at 1:45 PM
Resolved December 8, 2021 at 1:45 PM