INT-1702 polished the code so it doesn't throw unexpected exceptions during the ungraceful exit from the process (e.g., terminate Tomcat).
This commit is contained in:
@@ -118,7 +118,11 @@ public class ImapMailReceiver extends AbstractMailReceiver {
|
||||
protected Message[] searchForNewMessages() throws MessagingException {
|
||||
Flags supportedFlags = this.getFolder().getPermanentFlags();
|
||||
SearchTerm searchTerm = this.compileSearchTerms(supportedFlags);
|
||||
return searchTerm != null ? this.getFolder().search(searchTerm) : this.getFolder().getMessages();
|
||||
Folder folder = this.getFolder();
|
||||
if (folder.isOpen()){
|
||||
return searchTerm != null ? folder.search(searchTerm) : folder.getMessages();
|
||||
}
|
||||
throw new MessagingException("Folder is closed");
|
||||
}
|
||||
|
||||
private SearchTerm compileSearchTerms(Flags supportedFlags){
|
||||
|
||||
Reference in New Issue
Block a user