[ 
https://issues.apache.org/jira/browse/GERONIMO-4135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12607248#action_12607248
 ] 

Rick McGuire commented on GERONIMO-4135:
----------------------------------------

I've finally managed to hunt down the source of the extra line feeds, and it 
appears to be coming from the James SMTP code.  In the DataCmdHandler class, 
the message is getting created using the following code:  

            mail =
                new 
MailImpl(session.getConfigurationData().getMailServer().getId(),
                             (MailAddress) 
session.getState().get(SMTPSession.SENDER),
                             recipientCollection,
                             new SequenceInputStream(new 
SequenceInputStream(headersIn, msgIn),
                                     new ReaderInputStream(new 
StringReader("\r\n"))));

The outer-most SequenceInputStream() on the last argument is adding an extra 
CRLF sequence to the stream used to create the message.  Since the content data 
handler reads the from the stream until it hits the EOF, the extra CRLF gets 
attached to the end.  I can't find anything in the specifications that 
indicates a trailing CRLF should be discarded (and indeed, when the message was 
originally created, it wasn't), nor can I seem to find any reason why this is 
working with the Sun implementation.  Removing that extra SequenceInputStream 
makes the problem go away, but I suspect a problem would then show up with the 
Sun implementation.  At this point, I'm at a loss as to what should be fixed.  



> Too many CRLF at the end of the message
> ---------------------------------------
>
>                 Key: GERONIMO-4135
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-4135
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: mail
>    Affects Versions: 2.1.1
>            Reporter: Stefano Bagnara
>            Assignee: Rick McGuire
>
> We have a lot of tests trying to send a message to james and reading the 
> result: most of the tests fail because the result contains 2 trailing CRLF 
> more than expected (we send one crlf at the end of the message we receive 3 
> crlf).
> I don't exactly know where does it happen but this does not with sun 
> implementation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to