Claus,

Thanks...that got us further along but didn't quite work.  I finally got my
butt in gear and started doing camel builds, and I managed to get this
problem fixed.  Here's the scoop:

The Message instance we're working with is read-only.  So when calling
setHeader it threw:

javax.mail.IllegalWriteException: IMAPMessage is read-only
        at com.sun.mail.imap.IMAPMessage.setHeader(IMAPMessage.java:739)
        ...

The fix was to make a copy of the message object, and then we can modify the
copy.  But that's not all there is to it.  The problem cascaded out into
other accessors down the line, i.e. when headers and attachments get
processed.  Those actions would bump into the same
UnsupportedEncodingException, because they're working with that same
original instance of Message that has the funky charset.

So...the key is to call MailMessage.setMessage(ourModifiedInstance) so that
the modified copy gets used in other calls down the line.

But...of course that introduced a new problem: when marking the message
"SEEN" we were now marking the *copy* seen, not the original.  So it was
necessary for MailMessage to hold not only the modified instance, but also
the original Message instance, so that MailConsumer.processCommit could
setFlag on the original.  Otherwise, the message never got marked read.

Attached is a patch for camel/trunk that works.
http://old.nabble.com/file/p26266245/dcheckoway-charset-fix.diff
dcheckoway-charset-fix.diff 

Thanks for all your help on this and for putting up with me.  Maybe someday
I can become a committer...  :-)

Dan



Claus Ibsen-2 wrote:
> 
> On Sun, Nov 8, 2009 at 9:38 AM, dcheckoway <dchecko...@gmail.com> wrote:
>>
>> Sorry, I haven't yet.  I've been bogged with other stuff and haven't even
>> looked into how to build camel from source...excuses, excuses.  I hope to
>> get around to it in the next week or so and will definitely let you know!
>>
> 
> Hi
> 
> I have attached a .jar with a fix I have just coded. Can you test it
> on your system.
> The commit is rev 833857.
> 
-- 
View this message in context: 
http://old.nabble.com/Camel-Mail-issue-with-unsupported-charset-tp24755585p26266245.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to