Skip to content

clear forced xsi:type attribute state in ToXmlGenerator.writeName - #909

Open
Sahana2524 wants to merge 1 commit into
FasterXML:3.xfrom
Sahana2524:xsi-type-attr-state-leak
Open

clear forced xsi:type attribute state in ToXmlGenerator.writeName#909
Sahana2524 wants to merge 1 commit into
FasterXML:3.xfrom
Sahana2524:xsi-type-attr-state-leak

Conversation

@Sahana2524

Copy link
Copy Markdown
Contributor

writeName's synthetic xsi:type handling forces attribute mode and the XSI namespace onto the next value, and only the bean-serializer path clears it (by assigning the next name through setNextName):

  • a Map / JsonNode / @JsonAnyGetter key of xsi:type leaves every following sibling as an xsi:-prefixed attribute instead of an element
  • {"xsi:type":"A","type":"B"} emits a duplicate xsi:type attribute, so the module produces XML it can no longer read back
  • {"xsi:type":"T","nil":"true"} emits xsi:nil="true", so the whole document reads back as null

Clears the forced state on the next writeName for the content-driven case; the bean path already reset it via setNextName, so legitimate polymorphic output is unchanged.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 74.24% 📈 +0.050%
Branches branches 69.06% 📈 +0.090%

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