Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error: This operation is not allowed on a closed folder

923147Mar 15 2012 — edited Mar 15 2012
Hi,

I am using Javamail to deposit messages in bulk via IMAP.
Looking forward for some Input.. Thanks

I am able to get the Store for IMAP and the IMAP Folder too while accessing it through multiple threads for multiple users . However, while trying to close the IMAPFolder at the end of the call I am getting the below error.

Error:
====
java.lang.IllegalStateException: This operation is not allowed on a closed folder
at com.sun.mail.imap.IMAPFolder.close(IMAPFolder.java:1074)
at com.sun.mail.imap.IMAPFolder.close(IMAPFolder.java:1050)
at com.agnity.vm.mssAdaptor.provider.MessageProviderImpl.disconnectFromInbox(MessageProviderImpl.java:335)
.....

Source Code Snippet:
=========

try {
if (imapFolder != null && imapFolder.isOpen()) {
imapFolder.close(true);
}
} catch (MessagingException msgEx) {
msgEx.printStackTrace();
} finally {
try {
if (imapStore.isConnected()) {
imapStore.close();
}

} catch (MessagingException e) {
e.printStackTrace();
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 12 2012
Added on Mar 15 2012
2 comments
7,626 views