Skip to content

[fix][meta] Fix NPE in shouldIgnoreEvent when MetadataEvent options is null#26200

Open
SongOf wants to merge 1 commit into
apache:masterfrom
SongOf:fix/metadata-event-null-options-npe
Open

[fix][meta] Fix NPE in shouldIgnoreEvent when MetadataEvent options is null#26200
SongOf wants to merge 1 commit into
apache:masterfrom
SongOf:fix/metadata-event-null-options-npe

Conversation

@SongOf

@SongOf SongOf commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Motivation

AbstractMetadataStore#shouldIgnoreEvent normalizes a possibly-null
MetadataEvent#getOptions() into a local options variable
(options = event.getOptions() != null ? event.getOptions() : Collections.emptySet()),
but the ephemeral/sequential check on the next lines only used it for the first half of
the condition:

if (options.contains(CreateOption.Ephemeral) || event.getOptions().contains(CreateOption.Sequential)) {

When a synchronizer delivers a MetadataEvent whose options is null and the metadata
is not Ephemeral, the short-circuit falls through to
event.getOptions().contains(...) and throws a NullPointerException, so the event
fails to be processed instead of being handled by the remaining checks.

Modifications

Use the null-normalized local options variable for the CreateOption.Sequential
check as well, matching the CreateOption.Ephemeral check on the same line. No
behavior change other than removing the NPE path.

Verifying this change

- [x] Make sure that the change passes the CI checks.

This change is a trivial rework / code cleanup without any test coverage.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment

@void-ptr974 void-ptr974 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants