james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Bagnara <apa...@bago.org>
Subject Re: Using mime4j for parsing incoming emails
Date Fri, 01 Jul 2011 11:03:01 GMT
2011/7/1 Sharma, Ashish <ashish.sharma3@hp.com>:
> Norman,
>
> I got the following idea from one of the forums:
>
> "decode the attachments and then re-encode them. If the re-encoded stream matches (byte-for-byte)
the original, then that's a good sign that mime4j is properly handling them"

This won't work. Serialization is not done byte per byte identical to
the original version. It is semantically identical, but not byte per
byte. E.g: the way mime4j encodes quoted-printable or base64 is
hardcoded and cannot match any input encoding.

There's no way you can automatically verify if parsing is correct:
what we do is parsing using perl mime tools tests that generates xml
files in the same format we generate them using our testsuite. At most
you can check if mime4j results equals perl mime tools results and
manually check where it doesn't match.

We have a test suite, if you believe a message is not correctly parsed
submit it to us and we'll review.

> http://stackoverflow.com/questions/6521010/verifying-testing-the-output-of-mime4j-parsed-content
>
> What is your comment on this and what classes should I use for implementing the suggestion?

As I said I consider this approach useless.

> Thanks
> Ashish

What you ask is impossible: the fact that per parsed and rewritten
message equals don't even tell you that the parsing was correct,
anyway.

Stefano

Mime
View raw message