Fix #6043: honor FAIL_ON_UNKNOWN_PROPERTIES for creator-based POJOs-as-Array - #6047
Merged
cowtowncoder merged 3 commits intoJun 24, 2026
Conversation
Member
|
Makes sense, thank you for submitting this, @seonwooj0810 ! Two quick things:
|
…d POJOs-as-Array BeanAsArrayDeserializer._deserializeUsingPropertyBased silently skipped JSON Array elements past the property count, ignoring FAIL_ON_UNKNOWN_PROPERTIES for creator-based types such as records. Mirror the check already present on the non-creator deserialization paths.
seonwooj0810
force-pushed
the
fix/issue-6043-beanasarray-creator-failonunknown
branch
from
June 22, 2026 12:18
f903ba9 to
b7bfd2d
Compare
Contributor
Author
|
Thanks @cowtowncoder!
|
Member
|
Excellent! Thank you.
…On Mon, Jun 22, 2026 at 5:19 AM seonwoojung ***@***.***> wrote:
*seonwooj0810* left a comment (FasterXML/jackson-databind#6047)
<#6047 (comment)>
Thanks @cowtowncoder <https://github.com/cowtowncoder>!
1. Done — I've re-targeted this PR to the 3.2 branch. The fix is now
rebased on top of 3.2 (your Add tighter check to avoid potential false
failures commit is preserved on top), and POJOAsArrayTest passes
locally (27/27). The PR shows a clean 2-file diff against 3.2 and
reports as mergeable.
2. Yes, this is my first contribution here — I'll print, fill, sign
and email the CLA to ***@***.***
—
Reply to this email directly, view it on GitHub
<#6047?email_source=notifications&email_token=AAANOGL6K5TMT5KP65K4QHT5BEP3XA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINZWHAYTSNZWGE4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4768197618>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAANOGPK5TKSA7TA6GLFOPD5BEP3XAVCNFSNUABDKJSXA33TNF2G64TZHMZTAMZYHEZTOO2JONZXKZJ3GQ3TCMRUGI2TCNZTUF3AE>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AAANOGIBPJ5XGRWRVZVRJ4T5BEP3XA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINZWHAYTSNZWGE4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/AAANOGMZGFGHA6TGBA7F7U35BEP3XA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINZWHAYTSNZWGE4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Contributor
Author
|
Quick correction on the CLA front, @cowtowncoder: I actually already have a signed Jackson CLA on file — I had submitted it previously (emailed to cla@fasterxml.com) rather than this being a brand-new one, so there shouldn't be anything outstanding on that side. Apologies for the mixed signal in my earlier reply. Happy to re-send a copy if it's easier to confirm on your end. |
Member
|
No need -- I'll double-check I can find it when I get home. |
Member
|
Found it! Reason I was confused was Github comment on it being the first contribution -- but this is because your earlier PR was for |
cowtowncoder
approved these changes
Jun 24, 2026
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.
Fixes #6043
Root cause
For POJOs serialized as JSON Arrays (
@JsonFormat(shape = ARRAY)), the creator-based deserialization pathBeanAsArrayDeserializer._deserializeUsingPropertyBasedloops over array elements and, once it runs past the property count, hits theprop == nullbranch where it simplyskipChildren()and continues. Unlike the non-creator paths (deserialize/_deserializeNonVanilla), it never consultsFAIL_ON_UNKNOWN_PROPERTIES. As a result, extra array elements are silently ignored for creator-based types such asrecords, even when the feature is enabled.Change
Add the same
FAIL_ON_UNKNOWN_PROPERTIESguard already used on the non-creator paths to theprop == null(extra-element) branch of the creator path, reportingreportWrongTokenExceptionwith the existing "Unexpected JSON values; expected at most N properties" message. Behavior is unchanged when the feature is disabled or@JsonIgnoreProperties(ignoreUnknown = true)applies.Test evidence
Added
POJOAsArrayTest.testCreatorUnknownExtraPropusing the issue's reproduction (arecord XYZParams(int x, int y, int z)annotated@JsonFormat(shape = ARRAY)reading[1, 2, 3, 4]). It fails before the fix (no exception thrown — "should not pass with extra element") and passes after, and also asserts the value still deserializes correctly when the feature is disabled. FullPOJOAsArrayTest(27 tests) passes.Verification done: ran
./mvnw test -Dtest=POJOAsArrayTest(27/27 pass with fix); reverted the source change and confirmed the new test fails (assertion "should not pass with extra element"), then restored.