james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Burrell Donkin (JIRA)" <mime4j-...@james.apache.org>
Subject [jira] Closed: (MIME4J-48) NPE when parsing embedded quoted printable encoded message
Date Wed, 04 Feb 2009 20:52:00 GMT

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

Robert Burrell Donkin closed MIME4J-48.
---------------------------------------


Closing all issues fixed previously, after a brief review of each.

> NPE when parsing embedded quoted printable encoded message
> ----------------------------------------------------------
>
>                 Key: MIME4J-48
>                 URL: https://issues.apache.org/jira/browse/MIME4J-48
>             Project: JAMES 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.


Mime
View raw message