[ 
https://issues.apache.org/jira/browse/MIME4J-48?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12612780#action_12612780
 ] 

Niklas Therning commented on MIME4J-48:
---------------------------------------

Hmmm, ok. But I thought the stream wrapped by the QP stream in my fix is 
actually reading from the InputBuffer wrapping the root stream? Shouldn't that 
work?

> 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
>             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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to