0 Replies Latest reply on Jan 11, 2006 5:48 PM by Larry Wilson

    Exceptions thrown by Javamail and UTF-7 in JBoss

    Larry Wilson Newbie

      I've written a bounce back email system for our company (using javamail), and some messages are arriving encoded in UTF-7 variants.

      It's eating my lunch.

      I stumbled across what appears to be a totally cool OpenSource product - JCharset (http://www.freeutils.net/source/jcharset/), which, it would seem, would solve this.

      Several posts on the internet indicate people have indeed copied the jar into their apps and it works fine (most using Coldfusion). Problem is, mine is not working. Every time the mail processor encounters a UTF-7 email, it throws an exception.

      I've added jcharset.jar to my CLASSPATH variable. I've copied the jcharset.jar file into {jboss}/server/default/lib, {jboss}/lib, and even into WEB-INF of my application. Restarting the server after every change. No change in behavior.

      Mac OSX 10.4.4
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-83)
      Javamail 1.4ea
      JAF 1.1ea
      JCharset 1.2.1

      Here's an exception example:

      16:44:09,927 ERROR [BouncedMailJob] Unknown encoding type: null
      java.io.UnsupportedEncodingException: unicode-1-1-utf-7
       at sun.io.Converters.getConverterClass(Converters.java:218)
       at sun.io.Converters.newConverter(Converters.java:251)
       at sun.io.ByteToCharConverter.getConverter(ByteToCharConverter.java:68)
       at sun.nio.cs.StreamDecoder$ConverterSD.<init>(StreamDecoder.java:224)
       at sun.nio.cs.StreamDecoder$ConverterSD.<init>(StreamDecoder.java:210)
       at sun.nio.cs.StreamDecoder.forInputStreamReader(StreamDecoder.java:77)
       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:767)
       at javax.activation.DataHandler.getContent(DataHandler.java:519)
       at javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:618)
       at com.imc.quartz.jobs.BouncedMailJob.dumpPart(BouncedMailJob.java:571)
       at com.imc.quartz.jobs.BouncedMailJob.dumpPart(BouncedMailJob.java:628)
       at com.imc.quartz.jobs.BouncedMailJob.execute(BouncedMailJob.java:260)
       at org.quartz.core.JobRunShell.run(JobRunShell.java:195)
       at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

      Has anyone run across this before? Or have any ideas? I'm stumped.