james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Burrell Donkin (JIRA)" <server-...@james.apache.org>
Subject [jira] Assigned: (MIME4J-36) NullPointerException in Header.writeTo with missing Content-Type
Date Sun, 25 May 2008 10:29:55 GMT

     [ https://issues.apache.org/jira/browse/MIME4J-36?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Robert Burrell Donkin reassigned MIME4J-36:
-------------------------------------------

    Assignee: Robert Burrell Donkin

> 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


Mime
View raw message