Skip to content

Commit

Permalink
Fix NPE in ReindexDataStreamTransportAction (elastic#123262)
Browse files Browse the repository at this point in the history
In the multi-project branch, we're making some changes to persistent
tasks and those changes can cause the persistent tasks custom to still
be `null`. This resulted in an NPE here, so I'm fixing the check here.
  • Loading branch information
nielsbauman authored Feb 24, 2025
1 parent c40c5a6 commit 3f51012
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@ protected void doExecute(Task task, ReindexDataStreamRequest request, ActionList
ClientHelper.getPersistableSafeSecurityHeaders(transportService.getThreadPool().getThreadContext(), clusterService.state())
);
String persistentTaskId = getPersistentTaskId(sourceDataStreamName);

PersistentTasksCustomMetadata persistentTasksCustomMetadata = clusterService.state()
.getMetadata()
.custom(PersistentTasksCustomMetadata.TYPE);
PersistentTasksCustomMetadata.PersistentTask<?> persistentTask = persistentTasksCustomMetadata.getTask(persistentTaskId);
final var persistentTask = PersistentTasksCustomMetadata.getTaskWithId(clusterService.state(), persistentTaskId);

if (persistentTask == null) {
startTask(listener, persistentTaskId, params);
Expand Down

0 comments on commit 3f51012

Please sign in to comment.