FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix QName deserialization in JacksonExecutionContextStringSerializer by jjh75607 · Pull Request #5502 · spring-projects/spring-batch · GitHub

Fix QName deserialization in JacksonExecutionContextStringSerializer - #5502

Open
jjh75607 wants to merge 2 commits into
spring-projects:mainfrom
jjh75607:fix/qname-rejected-by-polymorphic-type-validator
Open

Fix QName deserialization in JacksonExecutionContextStringSerializer#5502
jjh75607 wants to merge 2 commits into
spring-projects:mainfrom
jjh75607:fix/qname-rejected-by-polymorphic-type-validator

Conversation

jjh75607 commented Aug 26, 2026
edited
Loading

Copy link
Copy Markdown

JacksonExecutionContextStringSerializer allows java.xml. in its BasicPolymorphicTypeValidator. But java.xml is a JPMS module name, not a package. The JDK package is javax.xml., so the entry matches nothing and every javax.xml.* type is denied.

The type this hits is javax.xml.namespace.QName, which Spring Batch writes to the execution context itself. With saveState enabled, StaxEventItemWriter stores the elements its header callback left open as a List<QName>, and reads them back in open().

Serialization succeeds, so the run completes normally. Only the restart fails, with InvalidTypeIdException ... denied resolution.

Both other serializers allow the class deliberately: Jackson2ExecutionContextStringSerializer since 398d52a, which fixed #4044, and DefaultExecutionContextSerializer since 46768dc.

The change is one line, java.xml. to javax.xml.. The added test round-trips a QName through the serializer. It fails on main with the exception above and passes with the change. The spring-batch-infrastructure, spring-batch-core, spring-batch-test and spring-batch-integration suites all pass.

If you would rather match the other two serializers exactly, allowIfSubType("javax.xml.namespace.QName") also works and I am happy to change it.

The same line is present in v6.0.0 and on 6.0.x, so I have left the backport judgement to you.

Related to but distinct from #4697. That issue is about the deprecated Jackson2ExecutionContextStringSerializer dropping a QName prefix. That behaviour is unchanged here and I will follow up there separately.

jjh75607 force-pushed the fix/qname-rejected-by-polymorphic-type-validator branch from 8931915 to 7b7ff76 Compare August 26, 2026 01:34

Copy link
Copy Markdown
Contributor

Thank you for this PR! That is a valid point.

If you would rather match the other two serializers exactly, allowIfSubType("javax.xml.namespace.QName") also works and I am happy to change it.

Yes please, for consistency with other serializers

fmbenhassine added the status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter label Aug 28, 2026
Signed-off-by: jjh75607 <jjh7560734@gmail.com>

Copy link
Copy Markdown
Author

Done. spring-batch-core passes, 819 tests.

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

Labels

status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StaxEventItemWriter.unclosedHeaderCallbackElements prevents new job execution

2 participants


Back | FazBrowse Home | New Git URL