Skip to content

Apply JAXB factory properties when creating unmarshallers - #3519

Merged
velo merged 1 commit into
OpenFeign:masterfrom
arimu1:fix/3056-jaxb-unmarshaller-properties
Aug 19, 2026
Merged

velo merged 1 commit into
OpenFeign:masterfrom
arimu1:fix/3056-jaxb-unmarshaller-properties

Conversation

@arimu1

@arimu1 arimu1 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

What

JAXBContextFactory.withProperty was applied when creating a Marshaller (JAXBEncoder) but not when creating an Unmarshaller (JAXBDecoder). Sharing one factory for encode and decode therefore dropped factory properties on unmarshal.

How

  • Apply the same factory property map in createUnmarshaller in both jaxb and jaxb-jakarta.
  • Skip properties the unmarshaller rejects (PropertyException) so existing withMarshaller* helpers (for example JAXB_FORMATTED_OUTPUT) still work when the same factory is used to decode.
  • Document the behavior on Builder.withProperty.

Testing

mvn -pl jaxb -am test -Dsurefire.failIfNoSpecifiedTests=false
mvn -pl jaxb-jakarta -am test -Dtest=JAXBContextFactoryTest,JAXBCodecTest -Dsurefire.failIfNoSpecifiedTests=false
  • feign-jaxb: Tests run: 32, Failures: 0, Errors: 0, Skipped: 0
  • feign-jaxb-jakarta: Tests run: 32, Failures: 0, Errors: 0, Skipped: 0

Regression coverage:

  • buildsUnmarshallerWithProperty — withProperty is visible on the created unmarshaller
  • decodesXmlUsingFactoryProperty — the property is used during unmarshal (IDResolver.startDocument)
  • buildsUnmarshallerWhenFactoryHasMarshallerProperties — marshaller-only keys do not break unmarshaller creation

Fixes #3056

Made with Cursor

`JAXBContextFactory.withProperty` was only applied to Marshallers.
Unmarshallers now receive the same properties; marshaller-only keys
are skipped so existing `withMarshaller*` plus decode setups keep working.

Fixes OpenFeign#3056

Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
@velo
velo merged commit a2676b8 into OpenFeign:master Aug 19, 2026
3 checks passed
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.

Allow JAXBContextFactory unmarshaller to have properties applied

2 participants