camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Camel Mail issue with unsupported charset
Date Mon, 03 Aug 2009 05:39:17 GMT
On Fri, Jul 31, 2009 at 2:27 PM, dcheckoway<> wrote:
> I'm using Camel Mail to route email messages to a handler.  Works
> perfectly...but I've bumped into an issue whenever somebody sends an email
> with an unsupported charset.  For example:
>     Content-type: text/plain; charset=ansi_x3.110-1983
> ...and since JDK6 has no idea wtf charset that is, I get the following
> exception:
> Caused by: ansi_x3.110-1983
>        at
> sun.nio.cs.StreamDecoder.forInputStreamReader(
>        at<init>(
>        at com.sun.mail.handlers.text_plain.getContent(
>        at
> javax.activation.DataSourceDataContentHandler.getContent(
>        at javax.activation.DataHandler.getContent(
>        at javax.mail.internet.MimeMessage.getContent(
>        at
> org.apache.camel.component.mail.MailBinding.extractBodyFromMail(
> This wouldn't be such a big deal if it wasn't for the fact that Camel is now
> totally hosed and can't "move past" that one message in the inbox.  Every
> time it subsequently polls the inbox, it throws that same exception and
> bails.  It can't access any other messages at that point.  I'm forced to go
> in and manually delete that one message so that Camel can continue
> processing the inbox.
> So here are my questions...
> 1. Is there any way I can somehow intercept/filter the route and manually
> tweak the Content-Type header on the MimeMessage?  I would happily munge the
> charset to a known value if I could...

There is a ContentTypeResolver in camel-mail that can help here
however it currently only supports when sending as the geronomi mail
provider is buggy and it allowed end users to work around issues with

I have created a ticket to extend this to consuming as well, that
would allow you to detect this content type and remove the invalid
charset name, so Camel will just use the platform default instead.

> 2. Is there any way Camel's behavior can be configured to "ignore messages
> on error" or something like that?

No as this is an issue within the transport itself and no message have
been handed over to Camel routing engine.
The problem lies in that the mail server has invalid/incompatible data
with Java 6.

You can extend the mail component yourself and work around it by
overriding the code in MailBinding and work around the invalid

> 3. Is there any way I can add Charset support for ansi_x3.110-1983?  Seems
> like that would be the ideal solution.

I have newer heard of such a charset. Can you try google this to see
if its actually a valid charset name. I do think that its a mistake
and the mail server do not care anyway.

Which mail server are you using?

And also you should always state which version of Camel you are using!

> For what it's worth, here's my route:
>            from("imaps://" +
>                 "username=" + username +
>                 "&password=" + password +
>                 "&deleteProcessedMessages=false" +
>                 "&processOnlyUnseenMessages=true" +
>                 "&consumer.delay=10003")
>                .process(handler);
> Thanks in advance for your help!
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Apache Camel Committer

Open Source Integration:

View raw message