You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Mark Ford <ma...@massfords.com> on 2011/08/03 16:52:51 UTC

toString in camel-mail MailConverters

The toString method in org.apache.camel.component.mail.MailConverters
is overloaded to handle both javax.mail.Message and
javax.mail.Multipart. The implementation fo the Message version checks
for a MimeMultipart instance and if so uses the first body part. The
implementation of the Multipart version walks the message and uses the
first text content type.

Why are these methods handling the conversion differently?

I came across this because the mail server I'm testing against
(squirrelmail) isn't returning Content-Type for MimeMultipart
messages. I kept seeing javax.mail.internet.MimeMultipart@123456 for
the message payload because the @Converter method is MailConverts was
not handling the case of the missing Content-Type and a default
toString was used. After reviewing the code, it looks like it would
work fine if I disabled the mapping of the Message content and left
the original payload as a javax.mail.Message.

Re: toString in camel-mail MailConverters

Posted by Claus Ibsen <cl...@gmail.com>.
Hi Mark

I dont think there is a reason for that. You are welcome to look into this.
Create a JIRA ticket and and if possible provide a patch.

We love contributions.
http://camel.apache.org/contributing.html



On Wed, Aug 3, 2011 at 4:52 PM, Mark Ford <ma...@massfords.com> wrote:
> The toString method in org.apache.camel.component.mail.MailConverters
> is overloaded to handle both javax.mail.Message and
> javax.mail.Multipart. The implementation fo the Message version checks
> for a MimeMultipart instance and if so uses the first body part. The
> implementation of the Multipart version walks the message and uses the
> first text content type.
>
> Why are these methods handling the conversion differently?
>
> I came across this because the mail server I'm testing against
> (squirrelmail) isn't returning Content-Type for MimeMultipart
> messages. I kept seeing javax.mail.internet.MimeMultipart@123456 for
> the message payload because the @Converter method is MailConverts was
> not handling the case of the missing Content-Type and a default
> toString was used. After reviewing the code, it looks like it would
> work fine if I disabled the mapping of the Message content and left
> the original payload as a javax.mail.Message.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/