OAK-12125: throw IllegalStateException for property index missing propertyNames#2784
Open
tmvlad wants to merge 1 commit intoapache:trunkfrom
Open
OAK-12125: throw IllegalStateException for property index missing propertyNames#2784tmvlad wants to merge 1 commit intoapache:trunkfrom
tmvlad wants to merge 1 commit intoapache:trunkfrom
Conversation
…pertyNames A property index definition without the required 'propertyNames' property caused a NullPointerException in PropertyIndexEditor that was not caught by IndexUpdate, breaking the entire async indexing cycle for all indexes. Fix: add a null check in PropertyIndexEditor constructor and throw an IllegalStateException with a clear message. IndexUpdate already catches IllegalStateException to gracefully skip bad index definitions and continue.
thomasmueller
requested changes
Apr 13, 2026
| PropertyState names = definition.getProperty(PROPERTY_NAMES); | ||
| if (names.count() == 1) { | ||
| if (names == null) { | ||
| throw new IllegalStateException("Missing required property '" + PROPERTY_NAMES + "' in property index definition"); |
Member
There was a problem hiding this comment.
So instead of a NPE we now get an IllegalStateException... It might currently resolve the problem, but I think it is not a good solution, because still an exception is thrown. There is a performance overhead in throwing an exception, but more importantly exception handing is not part of the API, and so changes in the future might break this logic. Also, there is no logging.
An alternative solution would be:
- Use a default value if no propertyNames are set, eg. use the value "propertyNamesIsMissing". A property name that is so unlikely to occur in practice that there are no repositories with this property. (And if there are, then actually it wouldn't be a problem.)
- Log a warning, but only once. Only once such that the log file is not filled.
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.
Links