james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel Bucher <gabriel.buc...@razor.ch>
Subject Re: bugs in the pop3 service
Date Thu, 27 Sep 2001 18:35:30 GMT
I found one of the bugs... the one for the STAT and TOP command.

The problem is in the class MailImpl in the method getSize()!

This is the wrong statement!
->Enumeration e = message.getAllHeader();
You get a Enumeration of Headers... if you later calculate the size of a 
header element 'size += ((Header)e.nextElement()).toString().length();' 
you dont get the header as a string, you will get the instance!

You can fix this with
->Enumeration e = message.getAllHeaderLines();
->size += ((String)e.nextElement()).length();

I changed this and tried it out again. I calculate myself a messages an 
compared it with what the STAT command said! It was different!
If I used only 'message.getSize()' then I got the right size!

I looked into JavaDoc of MimeMessage.getSize() and I was confused!
-> 'Return the size of the content of this message in bytes'.

Can someone check this out then I think the following method should be 
enough!
public int getSize() throws MessagingException {
     return message.getSize();
}


Cheers,
Buchi

Gabriel Bucher wrote:
> Hi together...
> 
> I played today a little bit around with the pop3 server! (User and Mail 
> store filebased).
> 
> I connected directly with telnet to the pop3 server! Following the log 
> from a telnet session:
> 
> +OK buchi POP3 server (JAMES POP3 Server 2.0a1-dev) ready
> user gabriel
> +OK
> pass gabriel
> +OK Welcome gabriel
> list
> +OK 1 429
> 1 431
> .
> stat
> +OK 1 429
> stat 1
> +OK 1 429
> list
> +OK 1 429
> 1 431
> .
> stat 1
> +OK 1 430
> retr 1
> +OK Message follows
> Return-Path: <guest@localhost>
> Received: from 127.0.0.1 ([127.0.0.1])
>           by buchi (JAMES SMTP Server 2.0a1-dev) with SMTP ID 48
>           for <gabriel@localhost>;
>           Wed, 26 Sep 2001 22:17:59 +0100
> Subject: Test
> Date: Wed, 26 Sep 2001 22:17:59 +0100
> From: guest@localhost
> 
> Another test...
> .
> stat
> +OK 1 431
> stat 1
> +OK 1 430
> quit
> +OK Apache James POP3 Server signing off.
> 
> This session is realy funny! Look at the message size if you send the 
> commands LIST and STAT!!! If got 3 different sizes!
> 
> I will try to fix this problem... and send patches for this!
> 
> Another problem I found today is, that if you use the TOP... you will 
> get twice the header of the message. I found the problem in the 
> MailImpl.writeContentTo()! With the method 'message.getInputStream' you 
> get the headers and the content but you will only the content!
> Im working on this...
> 
> Buchi
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


Mime
View raw message