Fix QName deserialization in JacksonExecutionContextStringSerializer - #5502
Open
jjh75607 wants to merge 2 commits into
Open
Fix QName deserialization in JacksonExecutionContextStringSerializer#5502jjh75607 wants to merge 2 commits into
jjh75607 wants to merge 2 commits into
Conversation
Signed-off-by: jjh75607 <jjh7560734@gmail.com>
jjh75607
force-pushed
the
fix/qname-rejected-by-polymorphic-type-validator
branch
from
August 26, 2026 01:34
8931915 to
7b7ff76
Compare
Contributor
|
Thank you for this PR! That is a valid point.
Yes please, for consistency with other serializers |
Signed-off-by: jjh75607 <jjh7560734@gmail.com>
Author
|
Done. |
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JacksonExecutionContextStringSerializerallowsjava.xml.in itsBasicPolymorphicTypeValidator. Butjava.xmlis a JPMS module name, not a package. The JDK package isjavax.xml., so the entry matches nothing and everyjavax.xml.*type is denied.The type this hits is
javax.xml.namespace.QName, which Spring Batch writes to the execution context itself. WithsaveStateenabled,StaxEventItemWriterstores the elements its header callback left open as aList<QName>, and reads them back inopen().Serialization succeeds, so the run completes normally. Only the restart fails, with
InvalidTypeIdException ... denied resolution.Both other serializers allow the class deliberately:
Jackson2ExecutionContextStringSerializersince 398d52a, which fixed #4044, andDefaultExecutionContextSerializersince 46768dc.The change is one line,
java.xml.tojavax.xml.. The added test round-trips aQNamethrough the serializer. It fails onmainwith the exception above and passes with the change. Thespring-batch-infrastructure,spring-batch-core,spring-batch-testandspring-batch-integrationsuites 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.0and on6.0.x, so I have left the backport judgement to you.Related to but distinct from #4697. That issue is about the deprecated
Jackson2ExecutionContextStringSerializerdropping aQNameprefix. That behaviour is unchanged here and I will follow up there separately.