Skip to content

Comments

fix: IndexOutOfBoundsException when serializing arrays in JacksonSerializer (#23600) (CP: 25.0)#23604

Merged
caalador merged 1 commit into25.0from
cherry/cherrypick-23600-to-25.0
Feb 23, 2026
Merged

fix: IndexOutOfBoundsException when serializing arrays in JacksonSerializer (#23600) (CP: 25.0)#23604
caalador merged 1 commit into25.0from
cherry/cherrypick-23600-to-25.0

Conversation

@mcollovati
Copy link
Collaborator

When serializing Java arrays, JacksonSerializer was using ArrayNode.set(i, value) on a newly created ArrayNode. In Jackson, set() expects an existing element at the given index, leading to an IndexOutOfBoundsException for new arrays.

This change switches to ArrayNode.add(value) to correctly populate the array. Additionally, support for deserializing JSON arrays back into Java arrays was added to ensure symmetry in JacksonSerializer.

Fixes #23583

…alizer (#23600)

When serializing Java arrays, JacksonSerializer was using ArrayNode.set(i, value)
on a newly created ArrayNode. In Jackson, set() expects an existing element at
the given index, leading to an IndexOutOfBoundsException for new arrays.

This change switches to ArrayNode.add(value) to correctly populate the array.
Additionally, support for deserializing JSON arrays back into Java arrays
was added to ensure symmetry in JacksonSerializer.

Fixes #23583
@sonarqubecloud
Copy link

@github-actions
Copy link

Test Results

1 314 files  ±0  1 314 suites  ±0   1h 21m 7s ⏱️ + 2m 30s
9 312 tests ±0  9 244 ✅ ±0  68 💤 ±0  0 ❌ ±0 
9 763 runs   - 6  9 690 ✅  - 4  73 💤  - 2  0 ❌ ±0 

Results for commit ae66cb6. ± Comparison against base commit 36dae9b.

@caalador caalador merged commit 9d308d9 into 25.0 Feb 23, 2026
30 checks passed
@caalador caalador deleted the cherry/cherrypick-23600-to-25.0 branch February 23, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants