[ 
https://issues.apache.org/jira/browse/MAILBOX-187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13537725#comment-13537725
 ] 

Eric Charles commented on MAILBOX-187:
--------------------------------------

Hi,

Thank you so much for your contributions.

>From the specs, I am also not sure if the fields and flags are mandatory, but 
>I agree that if an existing postfix+courier setup produces such files, we 
>should be able to handle them.

I would love to see the default being lenient parsing, also being able to run 
with strict parsing.
Would you mind posting another patch that adds a key to the 
mailbox-maildir.properties [1] and inject its value where needed (see [2]). 
Your code would throw exception in the strict option for any malformed name.

If you prefer running with lenient in all case, and if no one points any other 
strict spec, I agree to commit the current patch.

WDYT?

Thx again, Eric

[1] 
https://svn.apache.org/repos/asf/james/mailbox/trunk/spring/src/main/resources/mailbox-maildir.properties
[2] 
https://svn.apache.org/repos/asf/james/mailbox/trunk/spring/src/main/resources/META-INF/org/apache/james/spring-mailbox-maildir.xml
                
> Parsing bugs MaildirMessageName?
> --------------------------------
>
>                 Key: MAILBOX-187
>                 URL: https://issues.apache.org/jira/browse/MAILBOX-187
>             Project: James Mailbox
>          Issue Type: Bug
>          Components: maildir
>    Affects Versions: 0.4
>            Reporter: Eike Kettner
>         Attachments: mailbox-187.patch
>
>
> I'm trying to migrate my postfix+courier setup to apache james. I want to 
> keep my maildirs and so pointed james to my courier maildir folders. When 
> connecting to the mailbox, james threw `StringIndexArrayOutOfBoundsEx` and 
> `NullPointerEx` at me.
> The NPE came out of the class `MailderMessage`, while the IndexOutOfBounds 
> were coming from `MaildirMessageName`. All those exceptions were caused by 
> the filenames in my mailbox, that were not as expected by the parser. Looking 
> at the source, I found that while parsing a `MaildirMessageName`, the size 
> field is expected to be present. If not, parsing fails. I even have files in 
> my mailbox without neither attributes nor flags in the filename... This would 
> also cause the parser to fail.
> The NPE in `MaildirMessage` was due to a message without flags while setting 
> the RECENT flag in the constructor. There is another subtle potential NPE bug 
> in `MaildirMessage` when returning the size obtained from the 
> `MaildirMessageName` object. This could return null which would fail when 
> casting to a primitive long. Since the parser expects the size to be present, 
> this does not occur right now.
> While I'm fine with renaming my files to satisfy the `MaildirMessageName` 
> parser, I thought that it is better, if the parser would be more lenient 
> regarding the message filename. I also skimmed though this page 
> http://cr.yp.to/proto/maildir.html and couldn't find a hint that fields and 
> flags is a requirement of a message filename? But I'm very new to those 
> subjects and there may be another specification or I failed to understand. 
> Well, at the end, it would be great if the parser accepts my message 
> filenames, too :-). I'll attach a patch that aims to fix those things 
> (including a unit test), if you agree. 
> Thanks for such a great project, by the way!
> Kind Regards, Eike

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to