Skip to content
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

Remote config crash when retrieving integer value #3017

Merged
merged 5 commits into from
May 24, 2024
Merged

Conversation

pantstamp
Copy link
Contributor

@pantstamp pantstamp commented May 23, 2024

Fixes: wordpress-mobile/WordPress-Android#20857

Please read the above issue's description for context.

It seems that the issue we’re experiencing, where integer fields are being converted to doubles, is due to the deserialization process within the Gson library. Gson has a tendency to treat all numbers as doubles when deserializing generic Map objects, which is what we are seeing.

A new custom NumberAwareMapDeserializer was created which ensures that numbers are correctly parsed and converted to the appropriate type (e.g., integer, long, double) based on their value.

A minor refactoring was needed so this is used only for remote config calls.

Testing steps: Use this WordPress PR.

Copy link
Contributor

@zwarm zwarm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @pantstamp for fixing this! 🙇
I tested per instructions against the WP PR. I will leave the merging for you

@pantstamp pantstamp merged commit 01c9833 into trunk May 24, 2024
14 checks passed
@pantstamp pantstamp deleted the issue/20857 branch May 24, 2024 09:19
@pantstamp pantstamp self-assigned this May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remote config crash when retrieving integer value
2 participants