Skip to content

fix(jsonparser): support scientific notation parsing for int/long #3051

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

Conversation

BeomSeogKim
Copy link
Contributor

Fixes: #2995

Replaces the use of parseInt / parseLong in JsonParser.toTypedObject()
with BigDecimal.intValueExact() / longValueExact() to support scientific notation
(e.g., "1.5E7") safely and accurately.

  • Added tests for scientific notation in JsonParserTests

Fixes: spring-projects#2995

Replaces direct parseInt/parseLong with BigDecimal-based parsing to handle
scientific notation safely and accurately.

Signed-off-by: BeomSeogKim <[email protected]>
@ilayaperumalg
Copy link
Member

@BeomSeogKim Thanks for the PR. Rebased and merged as 69c081c

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

Successfully merging this pull request may close these issues.

NumberFormatException when model returns scientific notation (e.g., “1.5009969E7”) for int parameter in tool method
2 participants