From 7ce9f5cd1f455b40905b40d676e0c9abbf36c03c Mon Sep 17 00:00:00 2001 From: carlosdelest Date: Wed, 20 Dec 2023 10:40:16 +0100 Subject: [PATCH] Make PipelineIterator constructor depend just on strings --- .../org/elasticsearch/ingest/IngestService.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/ingest/IngestService.java b/server/src/main/java/org/elasticsearch/ingest/IngestService.java index d1eb12bc40988..5f19ae20ceefc 100644 --- a/server/src/main/java/org/elasticsearch/ingest/IngestService.java +++ b/server/src/main/java/org/elasticsearch/ingest/IngestService.java @@ -776,12 +776,8 @@ private PipelineIterator getAndResetPipelines(IndexRequest indexRequest) { final String pluginPipelineId = indexRequest.getPluginsPipeline(); indexRequest.setPluginsPipeline(NOOP_PIPELINE_NAME); - List pluginsPipelines = null; - if (pluginPipelineId != null) { - pluginsPipelines = getPluginsPipelines(pluginPipelineId); - } - return new PipelineIterator(pipelineId, finalPipelineId, pluginsPipelines); + return new PipelineIterator(pipelineId, finalPipelineId, pluginPipelineId); } /** @@ -801,14 +797,14 @@ private class PipelineIterator implements Iterator { private final String defaultPipeline; private final String finalPipeline; - private final List pluginsPipelines; + private final String pluginsPipelines; private final Iterator pipelineSlotIterator; - private PipelineIterator(String defaultPipeline, String finalPipeline, List pluginsPipelines) { + private PipelineIterator(String defaultPipeline, String finalPipeline, String pluginsPipelines) { this.defaultPipeline = NOOP_PIPELINE_NAME.equals(defaultPipeline) ? null : defaultPipeline; this.finalPipeline = NOOP_PIPELINE_NAME.equals(finalPipeline) ? null : finalPipeline; - this.pluginsPipelines = pluginsPipelines; + this.pluginsPipelines = NOOP_PIPELINE_NAME.equals(pluginsPipelines) ? null : pluginsPipelines; this.pipelineSlotIterator = iterator(); } @@ -825,7 +821,9 @@ private Iterator iterator() { slotList.add(new PipelineSlot(finalPipeline, getPipeline(finalPipeline), true)); } if (pluginsPipelines != null) { - slotList.addAll(pluginsPipelines.stream().map(pipeline -> new PipelineSlot("plugins", pipeline, false)).toList()); + slotList.addAll( + getPluginsPipelines(pluginsPipelines).stream().map(pipeline -> new PipelineSlot("plugins", pipeline, false)).toList() + ); } return slotList.iterator(); }