Re: BUG in classpathx javamail MBOX

Chris Burdess <[email protected]>
Newsgroups gmane.comp.java.classpath.extensions.javamail
Message-ID <[email protected]>
Countach wrote:
> There seems to be a bug in classpathx MBOX handling.
>
> If you pass into the store the URL of the actual MBOX file, then call
> getDefaultFolder(), it is named "" empty string, which is correct.
> However when you pass this into the store as store.getFolder("") it
> passes it to MboxFolder() and then it calls store.getMailRootDir(). In
> this function it has the commentary:
>
>   // If the url used to contruct the store references a file directly,
>    // return this file.
>
> However this is not true, because it has the code:
>
>             if (!f.isDirectory())
>                  {
>                    f = f.getParentFile();
>                  }
>

This is intended to mean "directory" in the commentary, which I have 
changed.

> This means the commentary is wrong, and getFolder("") will not return
> the default folder, but rather it tries to open the directory and gives
> an error.
>
> It seems to me the above lines should be removed. If somebody wants to
> treat a directory as a collection of folders, they will pass the
> directory in as the URL, and the above code will be unnecessary. And 
> the
> code as it is, is no good because
> store.getFolder(store.getDefaultFolder.getFullName()) causes an error
> when dealing with the actual MBOX file.

OK - I have supplied a fix which attempts to do what it says it does...
-- 
Chris Burdess
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.