james-server-dev mailing list archives

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

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

Oleg Kalnichevski commented on MIME4J-48:
-----------------------------------------

Hi Niklas,

This is a difficult case, something I must confess I did not quite anticipate. I am afraid
it is not good enough just to recreate the input buffer as there can be some data stuck in
it. Let me think this one over. 

Oleg

> 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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message