This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3775cce688c58d33b27b672bee2ed761da163105 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Fri Jan 3 20:24:44 2025 +0100 CAMEL-21580: camel-core: Fix rare potential ConcurrentModificationException when using producer template result processor during header copying. Use specialized processor as the message body is the only desired output so we avoid the header copying entirely. --- .../apache/camel/impl/engine/ProducerTemplateResultProcessor.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/ProducerTemplateResultProcessor.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/ProducerTemplateResultProcessor.java index 512f89bed6b..1852d0d65c1 100644 --- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/ProducerTemplateResultProcessor.java +++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/ProducerTemplateResultProcessor.java @@ -43,9 +43,8 @@ class ProducerTemplateResultProcessor implements Processor { return; } - Object newBody = exchange.getMessage().getBody(type); - if (newBody != null) { - exchange.getMessage().setBody(newBody); - } + // should be mandatory + Object newBody = exchange.getMessage().getMandatoryBody(type); + exchange.getMessage().setBody(newBody); } }