davsclaus opened a new pull request, #24924:
URL: https://github.com/apache/camel/pull/24924
_Claude Code on behalf of davsclaus_
## Summary
Fix two bugs in the async CXF-RS producer's `fail()` callback in both
`CxfInvocationCallback` and `CxfProxyInvocationCallback`:
1. **Reversed `isInstance` check** —
`throwable.getClass().isInstance(WebApplicationException.class)` always
evaluates to `false` because it tests whether the `Class` object is an instance
of the throwable's class (which it never is). Both `if` branches were dead
code, so every async failure fell through to `exchange.setException(throwable)`
with the raw JAX-RS exception instead of wrapping it in
`CxfOperationException`. Fixed by replacing with `throwable instanceof
WebApplicationException` (same for `ResponseProcessingException`).
2. **Silent exception swallowing** — When `shouldHandleError()` returned
`false` (e.g., `throwExceptionOnFailure=false` or status ≤ 207), neither
`handleError()` nor `exchange.setException()` was called — the exception was
silently dropped. Added `else { exchange.setException(throwable); }` fallback
in each branch.
## Impact
With the default `synchronous=false`, a server error (404/500) now correctly
yields a `CxfOperationException` (carrying status code, response headers and
body) — matching the synchronous path behavior.
`onException(CxfOperationException.class)` handlers now work consistently
regardless of sync/async mode.
## Test plan
- [x] Added `testAsyncProxyProducerServerErrorMappedToCxfOperationException`
— calls via the proxy client API with an invalid ID that triggers a 500 on the
server; verifies the exchange exception is `CxfOperationException` with status
500 (not a raw `InternalServerErrorException`)
- [x] All 18 existing `CxfRsAsyncProducerTest` tests pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.6 <[email protected]>
--
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]