angus-mail
angus-mail copied to clipboard
ConnectionListener's closed not invoked when connection is lost
When the IMAP server closes a connection while the IdleManager is waiting (watching), the ConnectionListener's closed is not invoked.
Here's a stack trace from this condition:
DEBUG IMAP: IdleManager got exception for folder: imap://xxxxxxxx/INBOX, THROW:
jakarta.mail.FolderClosedException: * BYE Jakarta Mail Exception: java.net.SocketException: Connection reset
at org.eclipse.angus.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3309)
at org.eclipse.angus.mail.imap.IdleManager.processKeys(IdleManager.java:351)
at org.eclipse.angus.mail.imap.IdleManager.select(IdleManager.java:262)
at org.eclipse.angus.mail.imap.IdleManager.access$200(IdleManager.java:111)
at org.eclipse.angus.mail.imap.IdleManager$1.run(IdleManager.java:140)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Going through the code, there's nothing that invokes the listeners.
To Reproduce Steps to reproduce the behavior:
- Setup IMAP server that closes connections after some idle time
- Open folder
- Add ConnectionListener to the folder
- IdleManager.watch folder
Expected behavior The closed method of all ConnectionListeners added to the folder should be invoked.