davsclaus opened a new pull request, #26032: URL: https://github.com/apache/camel/pull/26032
## Description The `org.apache.camel` package is `@NullMarked`, so unannotated reference parameters are treated as **non-null** under JSpecify. However, Camel fully supports `null` message bodies at runtime, and the sibling `FluentProducerTemplate` already annotates its `withBody` / `withHeader` / `withExchangeProperty` values as `@Nullable` (added in CAMEL-22640). `ProducerTemplate` was missed in that rollout, so callers with null-checking enabled were forced to work around a contract that does not match reality. This aligns `ProducerTemplate` with `FluentProducerTemplate`: - `@Nullable` added to all `body` parameters (`sendBody*`, `requestBody*`, `asyncSendBody`, `asyncRequestBody*`) - `@Nullable` added to `headerValue` and `propertyValue` parameters - Header/property **names** (`String header`, `String property`) and the `Map<String, Object> headers` remain **non-null** — keys cannot be null ## Impact - **Annotation-only** — JSpecify annotations have no runtime effect - **Source and binary compatible** — only relaxes a nullability constraint, so no existing caller can break - No upgrade-guide entry required ## Testing Added `DefaultProducerTemplateTest.testNullBodyAndValues`, driving a null body, null header value, and null property value through the API end-to-end (the property-value case had no prior direct coverage). Null bodies and null header values are already exercised widely across the core test suite. --- JIRA: https://issues.apache.org/jira/browse/CAMEL-24460 _Claude Code on behalf of @davsclaus_ -- 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]
