Skip to content

Improve number strategy implementation#1987

Merged
eamonnmcmanus merged 2 commits intogoogle:masterfrom
Marcono1234:marcono1234/GsonBuilder-copy-number-strategy
Oct 11, 2021
Merged

Improve number strategy implementation#1987
eamonnmcmanus merged 2 commits intogoogle:masterfrom
Marcono1234:marcono1234/GsonBuilder-copy-number-strategy

Conversation

@Marcono1234
Copy link
Copy Markdown
Contributor

@Marcono1234 Marcono1234 commented Oct 11, 2021

Follow-up for #1290 for some things I overlooked when I reviewed the changes a while ago.

@google-cla google-cla Bot added the cla: yes label Oct 11, 2021
Double d = Double.valueOf(value);
if ((d.isInfinite() || d.isNaN()) && !in.isLenient()) {
throw new MalformedJsonException("JSON forbids NaN and infinities: " + d + in);
throw new MalformedJsonException("JSON forbids NaN and infinities: " + d + "; at path " + in.getPath());
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Uses getPath() instead of (implicit) in.toString() because the line and column number included by toString() would point behind the value (since it has already been consumed).

@Marcono1234
Copy link
Copy Markdown
Contributor Author

@lyubomyr-shaydariv are these changes alright for you?

@lyubomyr-shaydariv
Copy link
Copy Markdown
Contributor

lyubomyr-shaydariv commented Oct 11, 2021

@Marcono1234 absolutely! I can't even recall what I implemented more than 3 years ago, but if you see it's not that good, I totally trust you!

@eamonnmcmanus Please consider merging these changes: I find them really good making #1290 better until it's released. Thank you!

@eamonnmcmanus
Copy link
Copy Markdown
Member

Thanks!

@eamonnmcmanus eamonnmcmanus merged commit bda2e3d into google:master Oct 11, 2021
@Marcono1234 Marcono1234 deleted the marcono1234/GsonBuilder-copy-number-strategy branch October 12, 2021 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants