Remmelt Pit created MIME4J-256:

             Summary: DefaultMessageBuilder.parseMessage should honor 
MaxHeaderLen over MaxLineLen
                 Key: MIME4J-256
             Project: James Mime4j
          Issue Type: Bug
    Affects Versions: 0.8.0
            Reporter: Remmelt Pit

Upon parsing a message using DefaultMessageBuilder.parseMessage(InputStream), 
the max header length is measured _after_ max line length, even for header 
lines. This should not be the case.

Our use case is to support body line lengths up to 1,000 characters, and header 
lines up to 10,000 characters. This is the default as found in 
>From these defaults, it would seem that header lines are measured differently 
>than body lines, and can be longer.

This is not actually the case, since header lines will also be measured like 
body lines, even _before_ they are measured as header lines.

Example code:
         String messageText = "From:\n" +
                "To:\n" +
                "\n" +

        MimeConfig mimeConfig = new MimeConfig.Builder()

        DefaultMessageBuilder messageBuilder = new DefaultMessageBuilder();

What I would expect to happen: Message is created without exception. 

What actually happens: MaxLineLimitException is thrown because of the "From:" 
header line.

For now a workaround could be to set the maxLineLength to -1, to disable that 
check. We don't want to run without the body line length check, though.

This message was sent by Atlassian JIRA

Reply via email to