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

   ## Summary
   
   Fixes [CAMEL-24403](https://issues.apache.org/jira/browse/CAMEL-24403).
   
   When an IMAP message is expunged between fetch time and the on-completion 
commit callback, `IMAPMessage.setFlag()` throws `MessageRemovedException` whose 
`getMessage()` returns `null`. This produced:
   
   ```
   Caused by: [javax.mail.MessageRemovedException - null]
   ```
   
   ### Changes
   
   - `MailConsumer.java` - catch `MessageRemovedException` before the generic 
`MessagingException` handler in `processCommit()`, wrap it with an explicit 
description so the log always shows a meaningful message:
   
   ```
   Caused by: [javax.mail.MessagingException - Message already removed/expunged 
on server (no flag update possible)]
   ```
   
   - `MailConsumerCommitExpungedMessageTest.java` (new) - 2 unit tests 
verifying the fix and that other MessagingExceptions pass through unchanged
   
   ### Test Results
   
   ```
   Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
   ```
   
   ### AI Attribution
   
   This contribution was developed with AI assistance using [Claude 
Code](https://github.com/anthropics/claude-code).
   
   ```
   Co-authored-by: Claude <[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]

Reply via email to