Files
spring-integration/spring-integration-mail/src
Artem Bilan 272fcd044d GH-9297: Improve ImapIdleChannelAdapter.callIdle() for cause
Fixes: #9297

For a normal `jakarta.mail.StoreClosedException: * BYE Jakarta Mail Exception: java.net.SocketException: Connection reset`
 the `ImapIdleChannelAdapter.callIdle()` results in a resubmission (and reconnection)
 with logging 'Failed to execute IDLE task. Will attempt to resubmit in 10000 milliseconds.'`
However, when `selectorExpression` is in used and that one is based on mail `Message` object,
we may fail with `FolderClosedException` which is wrapped to the `SpelEvaluationException` and some
other stack traces.
So, `jakarta.mail.MessagingException` might be deep in the cause chain.

* Fix `ImapIdleChannelAdapter` via introducing `getJakartaMailMessagingExceptionFromCause()` utility
method which searches for the `jakarta.mail.MessagingException` in cause chain.
* Rework `ImapIdleChannelAdapter.callIdle()` logic to rely on this new method

**Auto-cherry-pick to `6.3.x` & `6.2.x`**
2024-07-02 15:39:04 -04:00
..