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

Fix NPE in writeNumber(String) method of UTF8JsonGenerator, WriterBasedJsonGenerator #647

Merged
merged 1 commit into from
Oct 27, 2020

Conversation

pakru
Copy link
Contributor

@pakru pakru commented Oct 25, 2020

I faced NPE in writeNumber(String) of UTF8JsonGenerator when trying to pass null into this method.

gen.writeNumber(getStringValue());
where getStringValue() method can return null, and this causes NPE in writeRaw(String text) method of generator.
But it works fine for writeNumber(BigDecimal) and writeNumber(BigInteger) methods if I pass null into those methods.

Thus, I added null check for writeNumber(String encodedValue) the same as it made for BigDecimal and BigInteger types. Furthermore modified some tests for this nullability check.

@cowtowncoder
Copy link
Member

Looks legit, thank you! (and especial thanks for improving tests).

One practical thing before I merge this: unless I have asked for and received CLA (only needs to be done once, good for all PRs for Jackson repositories), I'd need this:

https://github.com/FasterXML/jackson/blob/master/contributor-agreement.pdf

and usually simplest way is to print, fill & sign, scan/photo, email to info at fasterxml dot com.
Once I receive it, we are good to go!

Thank you once again for your contribution!

@pakru
Copy link
Contributor Author

pakru commented Oct 27, 2020

Thanks for your feedback!
I have sent you signed CLA. Check you email, please.

@cowtowncoder cowtowncoder added this to the 2.11.4 milestone Oct 27, 2020
@cowtowncoder
Copy link
Member

Thanks! Received, will merge.

@cowtowncoder cowtowncoder merged commit e75a292 into FasterXML:2.11 Oct 27, 2020
@cowtowncoder cowtowncoder changed the title Fixed NPE in writeNumber(String) method of UTF8JsonGenerator and WriterBasedJsonGenerator Fix NPE in writeNumber(String) method of UTF8JsonGenerator, WriterBasedJsonGenerator Oct 27, 2020
cowtowncoder added a commit that referenced this pull request Oct 27, 2020
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.

None yet

2 participants