You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Danny Angus <da...@thought.co.uk> on 2002/01/15 12:39:54 UTC

bug report

Alan,
you wrote:
"I have developed a mailet, it works well when receiving mail from MS
outLook
Express, hotmail, netscape messenger.
But an exception is throw when receiving mail from MS outLook.
The exception thrown at :

	MimeMultipart mp = (MimeMultipart) mail.getMessage().getContent();

a class cast exception is thrown"

Two points,

1/ sending an email to the users or developers list
http://jakarta.apache.org/site/mail.html would probably be more appropriate
for this kind of support, its not really a bug.

2/ the line MimeMultipart mp = (MimeMultipart)
mail.getMessage().getContent();

Will throw this exception if the message is *not* MIME type multipart/*
As there are a zillion other types it can be you should use

MimeMessage message = mail.getMessage();
String type = message.getContentType();

and then getContent() into an appropriate object according to the
content-type expected.

Or .. Object x = mail.getMessage().getContent();
and only cast it to multipart once you know that you can.

d.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>