From 5b06076d1e108e6c4c6fd589fb750643b6ea8866 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Thu, 30 Oct 2008 20:10:32 +0000 Subject: [PATCH] Removed unnecessary folder closing call. --- .../integration/mail/ImapMailReceiver.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/org.springframework.integration.mail/src/main/java/org/springframework/integration/mail/ImapMailReceiver.java b/org.springframework.integration.mail/src/main/java/org/springframework/integration/mail/ImapMailReceiver.java index 6cd4d68314..fca4320e85 100755 --- a/org.springframework.integration.mail/src/main/java/org/springframework/integration/mail/ImapMailReceiver.java +++ b/org.springframework.integration.mail/src/main/java/org/springframework/integration/mail/ImapMailReceiver.java @@ -27,12 +27,18 @@ import javax.mail.search.AndTerm; import javax.mail.search.FlagTerm; import javax.mail.search.SearchTerm; -import org.springframework.integration.mail.monitor.MailTransportUtils; import org.springframework.util.Assert; import com.sun.mail.imap.IMAPFolder; /** + * A {@link MailReceiver} implementation for receiving mail messages from a + * mail server that supports the IMAP protocol. In addition to the pollable + * {@link #receive()} method, the {@link #waitForNewMessages()} method provides + * the option of blocking until new messages are available prior to calling + * {@link #receive()}. That option is only available if the server supports + * the {@link IMAPFolder#idle() idle} command. + * * @author Arjen Poutsma * @author Mark Fisher */ @@ -120,11 +126,7 @@ public class ImapMailReceiver extends AbstractMailReceiver { } } } - Message[] results = searchTerm != null ? this.getFolder().search(searchTerm) : this.getFolder().getMessages(); - if (results == null || results.length == 0) { - MailTransportUtils.closeFolder(this.getFolder()); - } - return results; + return searchTerm != null ? this.getFolder().search(searchTerm) : this.getFolder().getMessages(); }