IMAPFolder type issue
Chris Burdess <[email protected]>
| Newsgroups | gmane.comp.java.classpath.extensions.javamail |
|---|---|
| Message-ID | <[email protected]> |
Neil Campbell wrote:
> In IMAPFolder.getType(), as well as in IMAPFolder.getFolders(), the
> type is
> assigned to be either HOLDS_MESSAGES or HOLDS_FOLDERS. However, I
> note that
> the Sun implementation differs, in that a folder can hold both
> messages and
> folders.
>
> I'm not familiar enough with the IMAP protocol to know which is
> correct, but I
> think your implementation can be made to behave the same way as Sun's
> in this
> case by changing:
>
> type = entries[0].isNoinferiors() ?
> Folder.HOLDS_MESSAGES :
> Folder.HOLDS_FOLDERS;
>
> to something along the lines of
>
> type = 0;
>
> if(!entries[0].isNoinferiors()) {
> type |= Folder.HOLDS_FOLDERS;
> }
> if(!entries[0].isNoselect()) {
> type |= Folder.HOLDS_MESSAGES;
> }
>
> in both cases. Similarly, I suppose that in create(int type) the line:
> if (type == HOLDS_FOLDERS)
>
> should be:
> if ((type & HOLDS_FOLDERS) != 0)
>
> Does this seem reasonable?
Absolutely. Patch applied.
--
Chris Burdess