Posted By:
Dirk_Schulten
Posted On:
Friday, August 3, 2001 01:52 AM
Hello, I have a problem with JavaMail if the Content-Type ends with a semicolon. For example like in Content-Type: text/plain; The exception follows: java.lang.NullPointerException at sun.io.Converters.getConverterClass(Converters.java:78) at sun.io.Converters.newConverter(Converters.java:124) at sun.io.ByteToCharConverter.getConverter(ByteToCharConverter.java:67) at java.io.InputStreamReader. (InputStreamReader.java:78) at com.sun.mail.handlers.text_plain.getContent(text_plain.java:65) at javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:755) at javax.activation.DataHandler.getContent(DataHandler.java:511) a
More>>
Hello,
I have a problem with JavaMail if the Content-Type ends with a semicolon.
For example like in
Content-Type: text/plain;
The exception follows:
java.lang.NullPointerException
at sun.io.Converters.getConverterClass(Converters.java:78)
at sun.io.Converters.newConverter(Converters.java:124)
at sun.io.ByteToCharConverter.getConverter(ByteToCharConverter.java:67)
at java.io.InputStreamReader.
(InputStreamReader.java:78)
at com.sun.mail.handlers.text_plain.getContent(text_plain.java:65)
at javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:755)
at javax.activation.DataHandler.getContent(DataHandler.java:511)
at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:1259)
I'm not sure if it's my fault or if it's a bug in the mail api, because the sample program "showmsg" of the mailapi couldn't read it as well:
CONTENT-TYPE: text/plain;
Oops, got exception! null
javax.mail.internet.ParseException
at javax.mail.internet.ParameterList.
(ParameterList.java:58)
at javax.mail.internet.ContentType.
(ContentType.java:80)
at javax.mail.internet.MimeBodyPart.getFileName(MimeBodyPart.java:826)
at javax.mail.internet.MimeMessage.getFileName(MimeMessage.java:937)
at msgshow.dumpPart(msgshow.java, Compiled Code)
at msgshow.main(msgshow.java, Compiled Code)
Ok, it's a different error, but it is caused by the same problem.
You can reproduce that effect with a small perl code:
$MailTo = "mcdummy@fraggle.keller";
$MailFrom = "shadow@fraggle.keller";
$mailprog = '/usr/sbin/sendmail';
open (MAIL, "|$mailprog $MailTo");
print MAIL "From: $MailFrom
";
print MAIL "To: $MailTo
";
print MAIL "Content-Type: text/plain;
";
print MAIL "Subject: Testmail
";
print MAIL "TestmailEnds
";
print MAIL "
";
close (MAIL);
Please don't tell me to ask the sender to change the content-type, cause there are so many with illegal headers and there has to be a solution. Every time I get such a mail my program crashes and this is getting really annoying.
Thanks in advance,
Dirk Schulten.
<<Less