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 Cannot expunge READ_ONLY folder: INBOX

843834Sep 9 2010 — edited Sep 10 2010
Hi,

I'm trying to delete/move messages from folder INBOX. Sometimes we get error " Cannot expunge READ_ONLY folder: INBOX". I'm not able to reproduce this error in my local environment. So I’m assuming that it happens under load only.

I always open the folder in read_write mode. I looked at the java mail (1.4.3) API code and there are only two places where I can see the assignment of "mode" variable.

1. open method of IMAP folder. This method assign the mode value , whatever passed as parameter. So this method is fine.
2. close method of IMAP folder.
private void close(boolean expunge, boolean force)
throws MessagingException {

// If the expunge flag is set or we're open read-only we
// can just close the folder, otherwise open it read-only
// before closing.
if (!expunge && mode == READ_WRITE) {
try {
MailboxInfo mi = protocol.examine(fullName);
} catch (ProtocolException pex2) {
if (protocol != null)
protocol.disconnect();
}
}
if (protocol != null)
protocol.close();
}
Here we are trying to open the folder in read mode (when we examine). I understand the folder share underlying the protocol connection through java mail pool. I have default setting for java mail pool. Is it possible that two threads are sharing the same protocol connection so while one thread is trying to close it, another thread was trying to expunge it? I’m not too sure of my theory … or have I missed something in java mail API code?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 8 2010
Added on Sep 9 2010
6 comments
632 views