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

   Fixes [CAMEL-26122](https://issues.apache.org/jira/browse/CAMEL-26122).
   
   ## 1. A header with a null value fails the job launch
   
   **What was wrong:** `SpringBatchProducer.prepareJobParameters` turned a 
header with a null value into `addString(key, null)`. Spring Batch 6 rejects 
that with `IllegalArgumentException: Value for parameter 'nullHeader' must not 
be null`, so any exchange with a null header failed.
   
   **What changed:** headers with a null value are skipped. The misleading 
"avoid the NPE" comment is gone.
   
   ## 2. jobFromHeader=false does not stop the job name header
   
   **What was wrong:** the producer read `CamelSpringBatchJobName` on every 
exchange. With the default `jobFromHeader=false`, the header still replaced the 
job named in the endpoint URI with another registered `Job`.
   
   **What changed:** the producer reads that header only when the endpoint has 
`jobFromHeader=true`. With `jobFromHeader=false` the job from the URI is always 
launched.
   
   ## Tests
   
   Two new tests in `SpringBatchEndpointTest`. Both failed before the fix:
   - `shouldSkipNullHeadersWhenConvertingToJobParams` (failed with `Value for 
parameter 'nullHeader' must not be null`)
   - `shouldIgnoreJobNameHeaderWhenJobFromHeaderIsFalse` (failed: the launcher 
ran `dynamicMockjob` instead of the URI job)
   
   `mvn -o clean install -Psourcecheck` in the module: 28 tests, 0 failures. 
The existing `SpringBatchEndpointDynamicTest` (jobFromHeader=true) still passes.
   
   ## Docs and generated files
   
   - Component doc: null headers are skipped, and the job name header is only 
used with `jobFromHeader=true`.
   - Header description of `CamelSpringBatchJobName` and the `producerIn` body 
type text updated. Regenerated the component JSON, the catalog copies (JSON and 
adoc) and `SpringBatchEndpointBuilderFactory`.
   - Upgrade guide 4.24: new `camel-spring-batch` section. Routes that relied 
on the header with `jobFromHeader=false` must set `jobFromHeader=true`.
   
   ## Not changed
   
   - With `jobFromHeader=true`, the job name header is still also passed as a 
job parameter, as before.
   - The producer still copies the in headers to the out message.
   
   _Claude Code on behalf of Claus Ibsen (davsclaus)_
   
   🤖 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