[
https://issues.apache.org/jira/browse/CAMEL-26542?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-26542:
--------------------------------
Fix Version/s: 4.24.0
> camel-elasticsearch - the converter to SearchRequest.Builder builds a builder
> body and returns the used builder
> ---------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26542
> URL: https://issues.apache.org/jira/browse/CAMEL-26542
> Project: Camel
> Issue Type: Bug
> Components: camel-elasticsearch
> Reporter: Andrea Cosentino
> Assignee: Jiří Ondrušek
> Priority: Minor
> Fix For: 4.24.0
>
>
> Follow-up of CAMEL-26232 ([PR
> #29074|https://github.com/apache/camel/pull/29074]), raised in its review.
> {{ElasticsearchActionRequestConverter.toSearchRequestBuilder}} (main
> 8bd7c2ed53b7, lines 224-228) takes a {{SearchRequest.Builder}} as it is: it
> calls {{searchReqBuilder.build()}} to see whether an index is set, sets the
> index header on the same builder when none is, and returns that builder. A
> builder of the Elasticsearch Java client can be built only once, so a later
> {{build()}} of the returned builder fails with {{IllegalStateException}}
> ("Object builders can only be used once").
> The branch is reached only when the method is called directly: the type
> converter returns a body that already is a {{SearchRequest.Builder}} as it
> is, and the producer reads a builder body without the converter. So no route
> hits it today.
> Proposed: check the index without building the builder (or drop the branch),
> and add a test that builds the builder the method returns.
> _Claude Code on behalf of Andrea Cosentino (oscerd)_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)