Fix ArrayIndexOutOfBoundsException in CompositeBitmapIndex null handling#624
Open
hrstoyanov wants to merge 1 commit intoeclipse-store:mainfrom
Open
Fix ArrayIndexOutOfBoundsException in CompositeBitmapIndex null handling#624hrstoyanov wants to merge 1 commit intoeclipse-store:mainfrom
hrstoyanov wants to merge 1 commit intoeclipse-store:mainfrom
Conversation
- Add isEmpty() guards in internalHandleChanged() to properly handle composite key array length changes (e.g. NULL() Object[1] vs decomposed Instant Object[6]) - Dispatch to internalAddToEntry(), internalRemove(), or internalHandleChanged() based on old/new key presence per position - Add comprehensive test coverage for null↔non-null updates - Fixes issue reported by TourBiz project with Booking entity updates Signed-off-by: Hristo Todorov
Author
|
This addresses #623 |
Author
|
I have 100+ tests for Eclipse Store and with this fix it all pass now. Please release 4.0.2 |
Contributor
|
Thanks for the PR and the contribution. Due to our current review capacity, this will likely not be reviewed for at least a couple of weeks. Thank you for your patience. |
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.
Summary
Fixes
ArrayIndexOutOfBoundsExceptioninAbstractCompositeBitmapIndex.internalHandleChanged()when updating an entity from null to non-null composite key value (or vice versa).Issue Description
When an entity with a composite-indexed field (e.g.,
IndexerInstantforInstantfields) is:NULL()=Object[1]Object[6](for Instant's 6 components)The method would throw:
Root Cause
The original
internalHandleChanged()method calledensureSubIndices(newKeys)which grew thesubIndicesarray, then iterated all sub-indices callinginternalHandleChanged(oldKeys, ...). WhenoldKeyswas shorter than the new array (e.g., length 1 vs 6), accessingoldKeys[position]threw ArrayIndexOutOfBoundsException.Solution
Modified
internalHandleChanged()to checkisEmpty(oldKeys, i)andisEmpty(newKeys, i)per sub-index position:internalAddToEntry()internalRemove()internalHandleChanged()Files Changed
internalHandleChanged()method (lines 529-568)Testing
Test covers:
Impact
Discovered by TourBiz project during Booking entity updates with nullable Instant fields.