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

   Fixes [CAMEL-26132](https://issues.apache.org/jira/browse/CAMEL-26132).
   
   ### What was wrong
   
   With `splitEntries=true` (the default), `RssEndpoint.createExchange(feed, 
entry)` clones the `SyndFeed` to hold the one entry. When ROME's `clone()` 
failed with `CloneNotSupportedException` (ROME throws it when a feed property, 
for example from a module or foreign markup, cannot be cloned), the endpoint 
logged at DEBUG and sent the exchange with a `null` body. The route got an 
empty message and the entry was lost without a visible error.
   
   ### What changed
   
   - On a clone failure the endpoint now logs at WARN, keeps the `SyndEntry` as 
the body and sets a `RuntimeCamelException` (caused by the 
`CloneNotSupportedException`) on the exchange.
   - The exchange still goes through the route, so the route's error handler 
sees the failure: a dead letter channel or `onException` receives the entry 
instead of losing it. The happy path is unchanged.
   - I chose to fail the exchange rather than fall back to sending the entry as 
a normal message: the documented body type is a `SyndFeed`, and a route that 
reads it as a feed would break on a `SyndEntry` body.
   
   ### Tests
   
   New `RssEntryCloneFailureTest` with a `SyndFeedImpl` subclass whose 
`clone()` throws:
   - an end-to-end test where the split consumer polls a two-entry feed: 
`mock:result` gets nothing, the dead letter channel gets both entries as 
`SyndEntry` bodies with the `CloneNotSupportedException` as cause;
   - a direct test of `createExchange` (entry body, exception set, 
`CamelRssFeed` header kept).
   
   Both tests fail on main (the dead letter channel got 0 messages; the body 
was `null`) and pass with the fix. `mvn clean install -Psourcecheck` in 
`components/camel-rss`: 21 tests, 0 failures, 2 skipped (already `@Disabled`).
   
   ### Docs
   
   `rss-component.adoc` now says what happens when the feed cannot be copied; 
the catalog copy is regenerated. No options or headers changed. No upgrade 
guide entry: before, such an exchange had a `null` body, which no route could 
use.
   
   _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