Details
-
Bug
-
Resolution: Fixed
-
Medium
-
2.2.9
Description
See CSP-5793
An email with an unsupported encoding, e.g. Content-Type: text/plain; charset=unknown-8bit will cause this exception:
java.io.UnsupportedEncodingException: unknown-8bit
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:64)
at javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:745)
at javax.activation.DataHandler.getContent(DataHandler.java:501)
at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:1339)
at com.atlassian.mail.MailUtils.getAttachments(MailUtils.java:147)
We should catch this exception and read the bytes of the message with message.getInputStream() and convert it to a string using some default encoding (UTF8?)