james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Wiederkehr <markus.wiederk...@gmail.com>
Subject Re: mime4j don't read first line of a mail !!
Date Mon, 29 Jun 2009 12:30:57 GMT
On Mon, Jun 29, 2009 at 2:03 PM, Christophe MOURETTE
(AKIO)<cmo.akio@gmail.com> wrote:
> On Mon, Jun 29, 2009 at 12:48 PM, Markus Wiederkehr <
> markus.wiederkehr@gmail.com> wrote:
>
>> On Mon, Jun 29, 2009 at 11:57 AM, Christophe MOURETTE
>> (AKIO)<cmo.akio@gmail.com> wrote:
>> > On Mon, Jun 29, 2009 at 11:52 AM, Stefano Bagnara <apache@bago.org>
>> wrote:
>> >
>> >>
>> >> What mime4j version are you using?
>> >
>> >  maven artefact 0;6
>> >
>> >>
>> >> How do you load the message stream?
>> >
>> > with this code :
>> > IContentHandler handler = DefaultContentHandler.getInstance();
>> >            MimeStreamParser parser = new MimeStreamParser();
>> >            parser.setContentHandler(handler);
>> >            if (handler.containsCRLF(inputStream)){
>> >                parser.parse(inputStream);
>> >            }else{
>> >                parser.parse(new EOLConvertingInputStream(new
>> > BufferedInputStream(inputStream)));
>> >            }
>>
>> Okay, so you use your own ContentHandler implementation,
>> DefaultContentHandler, right?
>
>
> implements org.apache.james.mime4j.parser.ContentHandler

Mime4j does not come with a class called DefaultContentHandler so I
guess you wrote that one yourself? (And there is no IContentHandler
interface..)

Also your class DefaultContentHandler seems to contain a method called
containsCRLF() which I guess reads the first line of text from the
input stream to determine if the EOL style is CRLF or something else.

Unless containsCRLF() pushes the line back to the input stream it is
lost at the time you invoke the parse() method later on..

>> Did you make sure to push back the first line of text that your
>> implementation reads in it's containsCRLF() method?
>
>
> containsCRLF() is specific for cr with equals symbols each 80 chars.

Not sure if I understand.. Do you want to decode a qouted-printable
encoding? You don't have to do that, Mime4j takes care of it.

>
>
>>
>> Besides, I don't think you have to make that distinction, Mime4j
>> should be able to parse all kinds of eol styles automatically..
>
> i don't know if the problem is in this 2 methods :
>
> public void startMessage() throws MimeException {
>        if (stack.isEmpty()) {
>            stack.push(this.entity);
>        } else {
>            expect(Entity.class);
>            Message m = new Message();
>            ((Entity) stack.peek()).setBody(m);
>            stack.push(m);
>        }
>    }
>
> public void startHeader() throws MimeException {
>        stack.push(new Header());
>    }

Look like the code in Mime4j's class MessageBuilder; looks okay to me..

Markus

>
>
> Christophe.

Mime
View raw message