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

Fixing issue #1592 #1623

Merged
merged 1 commit into from Mar 2, 2020
Merged

Fixing issue #1592 #1623

merged 1 commit into from Mar 2, 2020

Conversation

fmmmlee
Copy link
Contributor

@fmmmlee fmmmlee commented Nov 26, 2019

Condensed #1620.

As cqjason describes in issue #1592, the behavior of JsonTreeWriter.name() is inconsistent with the method it overrides in its parent JsonWriter. When calling JsonWriter.name(null), a NullPointerException is thrown, while calling JsonTreeWriter.name(null) does not throw an exception, leading to a potentially misleading IllegalStateException when calling JsonTreeWriter.value() later in execution.

To resolve this, I just copied the null check from lines 385-387 of JsonWriter.

adding null parameter check to name(), fixing the issue and being consistent with superclass behavior
@fmmmlee fmmmlee changed the title Fixing https://github.com/google/gson/issues/1592 Fixing issue #1592 Nov 26, 2019
@fmmmlee fmmmlee mentioned this pull request Nov 26, 2019
@inder123 inder123 merged commit 55acc23 into google:master Mar 2, 2020
tibor-universe pushed a commit to getuniverse/gson that referenced this pull request Oct 20, 2021
adding null parameter check to name(), fixing the issue and being consistent with superclass behavior
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.

None yet

3 participants