oscerd opened a new pull request, #26590:
URL: https://github.com/apache/camel/pull/26590

   ## What
   
   Three small, shared robustness issues in `camel-elasticsearch` and 
`camel-opensearch`.
   
   ### 1. Scroll clear can NPE on a null scroll id
   `(Elasticsearch|Opensearch)ScrollRequestIterator.close()` built `new 
ClearScrollRequest.Builder().scrollId(List.of(scrollId))`. If the initial 
search returned no scroll id, `scrollId` is null and `List.of(null)` throws 
`NullPointerException` from `close()`, masking the real outcome. Now the 
clear-scroll is issued only when a scroll id is present.
   
   ### 2. A null index-id header clobbers a caller-supplied id
   In `(Elasticsearch|Opensearch)ActionRequestConverter`, when the body is 
already a pre-built `IndexRequest.Builder`/`UpdateRequest.Builder`, the 
converter called `.id(getHeader(PARAM_INDEX_ID))` unconditionally — overwriting 
a caller-set id with null when the `CamelIndexId` header was absent. Now the id 
is set only when the header is present. Also switched the elasticsearch 
document-only-mode check from reference equality (`== Boolean.TRUE`) to 
`Boolean.TRUE.equals(...)`.
   
   ### 3. size/from headers bleed downstream
   The producer defaults the size/from headers from the endpoint configuration 
when absent, but `cleanup()` removed only the index-name and 
wait-for-active-shards headers. A defaulted size/from therefore persisted on 
the exchange and leaked into a subsequent endpoint (the exact scenario the 
existing cleanup guards against for index-name). They are now removed in 
`cleanup()` too, tracked with the same `configXxx` pattern.
   
   ## Testing
   
   - New converter unit test in both components asserting a pre-built builder 
keeps its id when the header is absent, and that the header overrides it when 
present.
   - Verified both modules compile and their unit tests pass.
   
   ## Notes
   
   - Logic-only; no public API / `@UriParam` / generated-catalog change.
   - Backport candidate for `camel-4.22.x` and `camel-4.18.x`.
   
   _Generated by Claude Code on behalf of Andrea Cosentino (@oscerd)._
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to