Return null from nextTextValue() at end of input (2.x port of #899) - #902
Merged
Conversation
Port of the 3.x fix (PR #899 by @Sahana2524) to the 2.x line. FromXmlParser.nextTextValue() runs the XmlTokenStream event through a switch in which the XML_END branch has no `break`, so it falls into `default:` and throws IllegalStateException. One call past the last token therefore raises an unchecked exception instead of reporting end-of-input as null, the way nextToken() already does for XML_END; callers that only catch JsonProcessingException do not see it. Adds the missing `break` so XML_END reaches the method's shared `return null`, plus a test in XmlParserNextXxxTest covering one call past the end. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of #899 (3.x, by @Sahana2524) to the 2.x line.
FromXmlParser.nextTextValue()runs theXmlTokenStreamevent through a switch in which theXML_ENDbranch has nobreak, so it falls intodefault:and throws:One call past the last token therefore raises an unchecked exception instead of reporting end-of-input as
null, the waynextToken()already does forXML_END. Callers that only catchJsonProcessingExceptiondo not see it.Adds the missing
breaksoXML_ENDreaches the method's sharedreturn null, plus a test inXmlParserNextXxxTestmaking one call past the end (throws on 2.x as-is, returnsnullwith the fix).Verified: full 2.x suite green (423 tests); the new test fails without the one-line change and passes with it. Release notes updated for 2.23.0.
🤖 Generated with Claude Code