james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin McCartney <be_st...@yahoo.co.uk>
Subject Bug in QuotedPrintableInputStream
Date Mon, 27 Jan 2014 14:44:02 GMT

I was using Mime4j to validate some emails supplied through an API to one of our internal
systems.  Strict parsing was set to true.

Here is the behaviour of Mime4j that is I feel incorrect in QuotedPrintableInputStream.

A text file used as an inline attachment:

Content-Type: text/plain; charset=Cp1252
Content-Transfer-Encoding: quoted-printable

The second line below causes an error.  For clarity's sake I have added the the new line
characters as CR and LF.

<?xml version=3D"1.0" standalone=3D"no"?>CRLF
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/=CRLF
SVG/1.1/DTD/svg11.dtd" >CRLF

The stack trace of the error:

Caused by: java.io.IOException: Found LF without CR
at org.apache.james.mime4j.codec.QuotedPrintableInputStream.read0(QuotedPrintableInputStream.java:194)
at org.apache.james.mime4j.codec.QuotedPrintableInputStream.read(QuotedPrintableInputStream.java:306)
at java.io.InputStream.read(InputStream.java:101)
at org.apache.james.mime4j.message.BasicBodyFactory.bufferContent(BasicBodyFactory.java:53)
at org.apache.james.mime4j.message.BasicBodyFactory.textBody(BasicBodyFactory.java:43)
at org.apache.james.mime4j.message.EntityBuilder.body(EntityBuilder.java:151)
at org.apache.james.mime4j.parser.MimeStreamParser.parse(MimeStreamParser.java:133)
at org.apache.james.mime4j.message.DefaultMessageBuilder.parseMessage(DefaultMessageBuilder.java:311)

I believe that second line in my example is correct.  It was created by Sun's com.sun.mail.util.QPEncoderStream.

The equals indicates a soft line break and the following CRLF is the valid new line marker
for the mail message.

Any comments?



View raw message