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 "Aljoscha Rittner (JIRA)" <se...@james.apache.org> on 2008/02/21 22:41:19 UTC

[jira] Created: (MIME4J-36) NullPointerException in Header.writeTo with missing Content-Type

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


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


[jira] Updated: (MIME4J-36) NullPointerException in Header.writeTo with missing Content-Type

Posted by "Robert Burrell Donkin (JIRA)" <se...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/MIME4J-36?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Burrell Donkin updated MIME4J-36:
----------------------------------------

    Fix Version/s: 0.4

> 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


[jira] Closed: (MIME4J-36) NullPointerException in Header.writeTo with missing Content-Type

Posted by "Robert Burrell Donkin (JIRA)" <se...@james.apache.org>.
     [ 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


[jira] Assigned: (MIME4J-36) NullPointerException in Header.writeTo with missing Content-Type

Posted by "Robert Burrell Donkin (JIRA)" <se...@james.apache.org>.
     [ 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