- 
                Notifications
    You must be signed in to change notification settings 
- Fork 25.6k
Fix NullPointerException in SystemIndexMetadataUpgradeService hidden alias handling #84780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix NullPointerException in SystemIndexMetadataUpgradeService hidden alias handling #84780
Conversation
| Pinging @elastic/es-core-infra (Team:Core/Infra) | 
| Hi @williamrandolph, I've created a changelog YAML for you. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why AliasMetadata allows isHidden to be null, but this change does look like it should protect from null here.
| .anyMatch(a -> Objects.nonNull(a.isHidden()) && a.isHidden() == false)) { | ||
| for (AliasMetadata aliasMetadata : indexMetadata.getAliases().values()) { | ||
| if (aliasMetadata.isHidden() == false) { | ||
| if (Objects.nonNull(aliasMetadata.isHidden()) && aliasMetadata.isHidden() == false) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another way to write this, without a compound expression, would be:
if (Boolean.FALSE.equals(aliasMetadata.isHidden())) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…alias handling (elastic#84780) * Fix an NPE in hidden alias logic * Update docs/changelog/84780.yaml * Simplify conditional
…alias handling (elastic#84780) * Fix an NPE in hidden alias logic * Update docs/changelog/84780.yaml * Simplify conditional
There was a mysterious failure in an upgrade test. Examining the logs, I found a NullPointerException that wasn't revealed in the test failure message. Fixing the NPE fixed the test.
Should the
AliasMetadata#isHiddenmethod be nullable? I can't remember why it was written that way, but I can dig if there are any concerns about this fix.Fixes #81411