gnodet opened a new pull request, #28486:
URL: https://github.com/apache/camel/pull/28486
## Summary
Fixes **CAMEL-26301**: when the tokenizer EIP's tokenizer throws an
exception (e.g. a `NullPointerException` from a null body in
`AbstractLangChain4JTokenizer`/`SplitterUtil`), the exception escaped
`TokenizerProcessor.process()` without ever calling `callback.done(true)`. In
Camel's async processing model this meant the `AsyncCallback` was never
signalled and the caller hung indefinitely in
`DefaultAsyncProcessorAwaitManager.await`.
## Changes
**`TokenizerProcessor`** (`camel-core-processor`)
- Wrap `tokenizer.tokenize(exchange)` in a `try/catch`; on exception set it
on the exchange and call `callback.done(true)` before returning `true`.
- Follows the exact pattern used by `TransformProcessor` and other EIP
processors.
**`AbstractLangChain4JTokenizer`** (`camel-langchain4j-tokenizer`)
- Explicit null-body guard: throw a `RuntimeCamelException("Cannot tokenize
a null body")` instead of propagating an NPE from the LangChain4j splitter with
a confusing message.
**`TokenizerBodyTypesTest`**
- New test `nullBodyCompletesWithException()` covering the CAMEL-26301 hang:
verifies that sending `null` as the body does not hang the exchange and that an
exception is set on it instead.
## Testing
All 11 tests in `camel-langchain4j-tokenizer` pass, including the new test.
--
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]