Bug in 1.1.2: Folder.search() alters Folder.mode (works with 1.1.1)
Boris Folgmann <[email protected]> Wed, 11 Nov 2009 23:09:50 +0100
| Newsgroups | gmane.comp.java.classpath.extensions.javamail |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I've got a code that worked perfectly with mail 1.1.1 but has problems with
1.1.2.
----------------------------------------------------------------
store.connect();
Folder folder = store.getFolder("a cyrus imap folder");
folder.open(Folder.READ_WRITE);
log.info("Total messages: " + folder.getMessageCount());
Message[] msgs = folder.search(aTerm);
processMessages(msgs);
folder.expunge();
// folder.getMode() still returns Folder.READ_WRITE here
msgs = folder.search(aDifferentTerm);
// folder.getMode() now returns Folder.READ_ONLY!!
processMessages(msgs);
folder.expunge();
----------------------------------------------------------------
The second folder.expunge() throws
javax.mail.MessagingException: Folder was opened read-only
at gnu.mail.providers.imap.IMAPFolder.expunge(IMAPFolder.java:530)
Using some more log.info() I found out that the Folder.mode is altered by
the second search. I couldn't find anything in the JavaDocs that this is a
regular behaviour. As it worked with the previous release, you may know
what the problem could be.
I also update jaf from 1.0 to 1.1.1
cu,
boris