Skip to content

Allow for @JacksonXmlText in deserialization with nested builders - #906

Open
yuzawa-san wants to merge 1 commit into
FasterXML:3.xfrom
yuzawa-san:nested-builder-with-text
Open

Allow for @JacksonXmlText in deserialization with nested builders#906
yuzawa-san wants to merge 1 commit into
FasterXML:3.xfrom
yuzawa-san:nested-builder-with-text

Conversation

@yuzawa-san

Copy link
Copy Markdown

I wrote a breaking test with my schema (that has builders) and it failed with:

BuilderWithTextValueTest.testNestedBuilderWithTextValue:101 » Databind Cannot cast tools.jackson.dataformat.xml.deser.builder.BuilderWithTextValueTest$Inner$InnerBuilder to tools.jackson.dataformat.xml.deser.builder.BuilderWithTextValueTest$Inner
 at [Source: (String)"<Outer><Inner>Value</Inner></Outer>"; line: 1, column: 28] (through reference chain: tools.jackson.dataformat.xml.deser.builder.BuilderWithTextValueTest$Outer$OuterBuilder["Inner"])

It appears the XmlTextDeserializer tries to return a builder to a calling deserializer which is expecting a real instance.

I believe the solution is to make the logic to use createUsingDefault to consider if there is the ValueInstantiator returns a builder.

If there is a builder then use the logic in _deserializeFromStringViaDelegate

BuilderWithTextValueTest.testNestedBuilderWithTextValue:101 » Databind Cannot cast tools.jackson.dataformat.xml.deser.builder.BuilderWithTextValueTest$Inner$InnerBuilder to tools.jackson.dataformat.xml.deser.builder.BuilderWithTextValueTest$Inner
 at [Source: (String)"<Outer><Inner>Value</Inner></Outer>"; line: 1, column: 28] (through reference chain: tools.jackson.dataformat.xml.deser.builder.BuilderWithTextValueTest$Outer$OuterBuilder["Inner"])
@yuzawa-san yuzawa-san changed the title Allow for @JacksonXmlText in nested builders Allow for @JacksonXmlText in deserialization with nested builders Aug 28, 2026
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