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

Improve number strategy implementation #1987


Copy link

@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
@@ -71,11 +71,11 @@
try {
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
Collaborator 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).

Copy link
Collaborator Author

@lyubomyr-shaydariv are these changes alright for you?

Copy link

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!

Copy link


@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
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants