On Fri, Jul 31, 2009 at 2:27 PM, dcheckoway<dchecko...@gmail.com> 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: java.io.UnsupportedEncodingException: ansi_x3.110-1983
>        at
> sun.nio.cs.StreamDecoder.forInputStreamReader(StreamDecoder.java:52)
>        at java.io.InputStreamReader.<init>(InputStreamReader.java:83)
>        at com.sun.mail.handlers.text_plain.getContent(text_plain.java:82)
>        at
> javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:775)
>        at javax.activation.DataHandler.getContent(DataHandler.java:522)
>        at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:1380)
>        at
> org.apache.camel.component.mail.MailBinding.extractBodyFromMail(MailBinding.java:108)
>
> 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
it.

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.
https://issues.apache.org/activemq/browse/CAMEL-1869


> 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
charset.


> 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://imap.gmail.com?" +
>                 "username=" + username +
>                 "&password=" + password +
>                 "&deleteProcessedMessages=false" +
>                 "&processOnlyUnseenMessages=true" +
>                 "&consumer.delay=10003")
>                .process(handler);
>
> Thanks in advance for your help!
> --
> View this message in context: 
> http://www.nabble.com/Camel-Mail-issue-with-unsupported-charset-tp24755585p24755585.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to