http://kenai.com/bugzilla/show_bug.cgi?id=3539
Summary: Multiparts do not parse correctly in presence of
legacy Mac line endings
Product: javamail
Version: 1.4.3
Platform: PC
OS/Version: Mac OS
Status: NEW
Severity: normal
Priority: P5
Component: source
AssignedTo: shannon_at_kenai.com
ReportedBy: trejkaz_at_kenai.com
CC: issues_at_javamail.kenai.com
Created an attachment (id=426)
--> (
http://kenai.com/bugzilla/attachment.cgi?id=426)
Example email
I'm attaching an example email which has a Multipart at the top-level, but
Multipart.getCount() returns 1 instead of 3. After investigating this for
almost a day, it turns out that the problem is related to the line endings. If
we convert them to \n up-front then JavaMail can parse the result correctly.
@Test
public void testMultipartWithMacLineEndings() throws Exception
{
byte[] data = FileUtils.readFileToByteArray(new File("G:\\Invoice
Receipt copy.eml"));
Session session = Session.getDefaultInstance(new Properties());
MimeMessage mimeMessage = new MimeMessage(session, new
ByteArrayInputStream(data));
Multipart topMultipart = (Multipart) mimeMessage.getContent();
assertEquals("Wrong number of parts", 3, topMultipart.getCount());
}
--
Configure bugmail: http://kenai.com/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.