You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Robert Burrell Donkin (JIRA)" <se...@james.apache.org> on 2008/05/25 12:57:55 UTC
[jira] Closed: (MIME4J-36) NullPointerException in Header.writeTo
with missing Content-Type
[ https://issues.apache.org/jira/browse/MIME4J-36?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Burrell Donkin closed MIME4J-36.
---------------------------------------
Resolution: Fixed
Fix committed. Thanks for the accurate report.
> NullPointerException in Header.writeTo with missing Content-Type
> ----------------------------------------------------------------
>
> Key: MIME4J-36
> URL: https://issues.apache.org/jira/browse/MIME4J-36
> Project: Mime4j
> Issue Type: Bug
> Reporter: Aljoscha Rittner
> Assignee: Robert Burrell Donkin
> Fix For: 0.4
>
> Original Estimate: 0.08h
> Remaining Estimate: 0.08h
>
> I get a NPE with very simple mails.
> java.lang.NullPointerException
> at org.apache.james.mime4j.message.Header.writeTo(Header.java:148)
> at org.apache.james.mime4j.message.Message.writeTo(Message.java:86)
> IMHO, a missing Content-Type is legal (in this case, the body is text/plain).
> The writeTo Method in Header needs an extra if-clause for missing Content-Type header.
> org.apache.james.mime4j.message.Header
> ...
> public void writeTo(OutputStream out) throws IOException {
> /////////////////// NPE in case of missing Content-Type declaration:
> String charString = ((ContentTypeField) getField(Field.CONTENT_TYPE)).getCharset();
>
> BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, CharsetUtil.getCharset(charString)),8192);
> writer.write(toString()+ "\r\n");
> writer.flush();
> }
> best regards,
> josh.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org