Skip to content

return null from nextStringValue() at end of input - #899

Open
Sahana2524 wants to merge 1 commit into
FasterXML:3.xfrom
Sahana2524:nextstringvalue-end-of-input
Open

return null from nextStringValue() at end of input#899
Sahana2524 wants to merge 1 commit into
FasterXML:3.xfrom
Sahana2524:nextstringvalue-end-of-input

Conversation

@Sahana2524

Copy link
Copy Markdown
Contributor
java.lang.IllegalStateException: Internal error: unrecognized XmlTokenStream token: 8

nextStringValue() runs the XmlTokenStream event through a switch, but the XML_END branch has no break and falls into the default: case that throws. So one call past the last token raises an unchecked exception instead of reporting end-of-input as null, the way nextToken() already does for XML_END. Callers that only catch JacksonException do not see it.

Added the missing break so the XML_END case reaches the method's shared return null. Extended the existing XmlParserNextXxxTest with one call past the end, which throws on the current tree and now returns null.

@github-actions

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 74.11% 📈 +0.030%
Branches branches 68.77% 📈 +0.050%

Coverage data generated from JaCoCo test results

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.

1 participant