james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niklas Therning (JIRA)" <server-...@james.apache.org>
Subject [jira] Resolved: (MIME4J-48) NPE when parsing embedded quoted printable encoded message
Date Fri, 11 Jul 2008 09:00:32 GMT

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

Niklas Therning resolved MIME4J-48.
-----------------------------------

    Resolution: Fixed

Checked in the fix. I've also added the test message I attached as a test in MultipartTokensTest.

> NPE when parsing embedded quoted printable encoded message
> ----------------------------------------------------------
>
>                 Key: MIME4J-48
>                 URL: https://issues.apache.org/jira/browse/MIME4J-48
>             Project: Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.4
>            Reporter: Niklas Therning
>            Assignee: Niklas Therning
>             Fix For: 0.4
>
>         Attachments: 36442979.msg
>
>
> When trying to parse a message which contains an embedded quoted printable message I
received a NullPointerException:
> Exception in thread "main" java.lang.NullPointerException
> 	at org.apache.james.mime4j.decoder.QuotedPrintableInputStream.populatePushbackQueue(QuotedPrintableInputStream.java:85)
> 	at org.apache.james.mime4j.decoder.QuotedPrintableInputStream.fillBuffer(QuotedPrintableInputStream.java:119)
> 	at org.apache.james.mime4j.decoder.QuotedPrintableInputStream.read(QuotedPrintableInputStream.java:57)
> 	at org.apache.james.mime4j.BufferingInputStreamAdaptor.doReadLine(BufferingInputStreamAdaptor.java:78)
> 	at org.apache.james.mime4j.BufferingInputStreamAdaptor.readLine(BufferingInputStreamAdaptor.java:68)
> 	at org.apache.james.mime4j.AbstractEntity.fillFieldBuffer(AbstractEntity.java:129)
> 	at org.apache.james.mime4j.AbstractEntity.parseField(AbstractEntity.java:162)
> 	at org.apache.james.mime4j.MimeEntity.advance(MimeEntity.java:97)
> 	at org.apache.james.mime4j.MimeTokenStream.next(MimeTokenStream.java:363)
> 	at Mime4jTest.main(Mime4jTest.java:83)
> I've figured out that it is the following code in MimeEntity which passes the null stream
when creating the QuotedPrintableInputStream:
>     private EntityStateMachine nextMessage() {
>         String transferEncoding = body.getTransferEncoding();
>         InputStream instream;
>         if (MimeUtil.isBase64Encoding(transferEncoding)) {
>             log.debug("base64 encoded message/rfc822 detected");
>             instream = new Base64InputStream(mimeStream);                    
>         } else if (MimeUtil.isQuotedPrintableEncoded(transferEncoding)) {
>             log.debug("quoted-printable encoded message/rfc822 detected");
>             instream = new QuotedPrintableInputStream(mimeStream);                  
 
>         } else {
>             instream = dataStream;
>         }
> mimeStream seems to be null in this situation. I've tried to use dataStream instead of
mimeStream. This seems to work better but when I do that I get an infinite loop when trying
to parse an embedded multipart message which has =3D in its boundary. I'll attach such a message.

-- 
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