Re: Bug in 1.1.2: Folder.search() alters Folder.mode (works with 1.1.1)
Chris Burdess <[email protected]> Fri, 13 Nov 2009 07:23:22 +0000
| Newsgroups | gmane.comp.java.classpath.extensions.javamail |
|---|---|
| Message-ID | <[email protected]> |
Boris Folgmann wrote:
> 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.
The mode is only changed from a call to update(MailboxStatus,
boolean). This can happen during various method calls, but not search
(). Are you sure this is your complete code with respect to IMAPFolder?
--
Chris Burdess