gnodet opened a new pull request, #2939:
URL: https://github.com/apache/cxf/pull/2939

   ## Summary
   
   - **Root cause**: In `FailoverTargetSelector.performFailover()`, the 
exception on `outMessage` is unconditionally cleared before the retry attempt 
(`outMessage.setContent(Exception.class, null)`), but the `catch` block only 
conditionally restores it (`if (outMessage.getContent(Exception.class) != 
null)`). Since the exception was already cleared, this condition is always 
`false`, so the exception is never restored when a retry fails.
   - **Effect**: The fault observer in `ClientImpl.doInvoke()` sees no 
exception on the message and enters the "handle the right response" path, where 
`exchange.getInMessage()` returns `null` (the exchange was cleared by 
`exchange.clear()`), causing a `NullPointerException`.
   - **Fix**: Unconditionally restore the previous exception and exchange fault 
in the `catch` block of `performFailover()`. Also add a defensive null check 
for `inMsg` in `ClientImpl`'s fault observer.
   
   ## Changes
   
   1. `FailoverTargetSelector.performFailover()` — always restore the original 
exception when the retry fails
   2. `ClientImpl.doInvoke()` fault observer — add null guard for `inMsg` after 
failover  
   3. New `FailoverTargetSelectorTest` — verifies exception restoration on 
failed retry
   
   ## Test plan
   
   - [x] New unit test 
`FailoverTargetSelectorTest.testExceptionRestoredOnFailedRetry` passes with 
fix, fails without
   - [x] Existing `core` endpoint tests pass
   - [ ] Systests clustering `FailoverTest` (manual verification recommended)
   - [ ] Camel CXF `FailOverFeatureTest.testPojo()` should now pass (the 
original reproducer)
   
   🤖 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