Re: Gnu mail bug
Countach <[email protected]>
| Newsgroups | gmane.comp.java.classpath.extensions.javamail |
|---|---|
| Message-ID | <[email protected]> |
Chris Burdess wrote:
> Countach wrote:
>
>> You seem to have changed my patch resulting in a bug.
>>
>> My patch said:
>>
>> protected MboxFolder(MboxStore store, String name, boolean inbox)
>> {
>> super(store);
>> this.name = name;
>> if (0 < name.length() && name.charAt(0) == '/') {
>> file = new File(canonicalNameToLocal(name));
>> } else {
>> file = new File(store.getMailRootDir(),
>> canonicalNameToLocal(name));
>> }
>>
>>
>> But the cvs code seems to say:
>>
>> protected MboxFolder(MboxStore store, String name, boolean inbox)
>> {
>> super(store);
>> this.name = name;
>> file = new File(store.getMailRootDir(), canonicalNameToLocal(name));
>>
>> The trouble is, this only allows for relative names. My original
>> patch checked for the leading '/' so that you could use relative or
>> absolute paths.
>
>
> The problem is that URLName.getFile returns paths that do not include
> the leading '/', unlike java.net.URL. Typically, in JavaMail
> applications, the mailbox is represented as a URLName rather than the
> user being able to specify the exact string to pass to getFolder(). We
> need a consistent way to treat file paths that doesn't depend on a
> leading '/' - if you have any suggestions they would be most welcome.
I'm not sure I understand the problem. The name argument passed to
getFolder is pretty much just a string that can have any significance
necessary for that type of mail repository. It is not a URL. It is the
name argument that is checked to see if it starts with "/", not the url
nor the File.