james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Bagnara <apa...@bago.org>
Subject Re: svn commit: r406781 - in /james/server/trunk/src/test/org/apache/james: smtpserver/SMTPServerTest.java test/mock/james/MockMailServer.java
Date Tue, 16 May 2006 10:45:31 GMT
Bernd Fondermann wrote:
> this change confuses me. I guess m_maxMessageSizeBytes holds KBs and 
> bodySize holds Bytes? should I change the var name to m_maxMessageSizeKB 
> then so I can get my mind straight again? ;-)

I gave no importance at the variable name (my fault). I looked at the 
usage of that variable and I saw it was behaving wrong.

Maybe the best place where to apply the fix was in SMTPServerTes:

private void finishSetUp(SMTPTestConfiguration testConfiguration) throws 
Exception {
testConfiguration.init();
ContainerUtil.configure(m_smtpServer, testConfiguration);
ContainerUtil.initialize(m_smtpServer);
m_mailServer.setMaxMessageSizeBytes(m_testConfiguration.getMaxMessageSize());
}

changing it to:
m_mailServer.setMaxMessageSizeBytes(m_testConfiguration.getMaxMessageSize()*1024);

That said, you know your code better than me, so feel free to refactor 
it and put the fix where you prefer.

> bago@apache.org wrote:
>> Author: bago
>> Date: Mon May 15 16:59:53 2006
>> New Revision: 406781
>>
>> URL: http://svn.apache.org/viewcvs?rev=406781&view=rev
>> Log:
>> Converted SMTPServerTest to use commons-net SMTPClient instead of 
>> ristretto SMTPProtocol (part of JAMES-498)
>> Added two tests, fixed a bug in the size check of the mock MailServer.
>>
>> Modified: 
>> james/server/trunk/src/test/org/apache/james/test/mock/james/MockMailServer.java

>>
>> URL: 
>> http://svn.apache.org/viewcvs/james/server/trunk/src/test/org/apache/james/test/mock/james/MockMailServer.java?rev=406781&r1=406780&r2=406781&view=diff

>>
>> ============================================================================== 
>>
>> --- 
>> james/server/trunk/src/test/org/apache/james/test/mock/james/MockMailServer.java

>> (original)
>> +++ 
>> james/server/trunk/src/test/org/apache/james/test/mock/james/MockMailServer.java

>> Mon May 15 16:59:53 2006
>> @@ -59,7 +59,7 @@
>>      public void sendMail(Mail mail) throws MessagingException {
>>          int bodySize = mail.getMessage().getSize();
>>          try {
>> -            if (m_maxMessageSizeBytes != 0 && m_maxMessageSizeBytes <

>> bodySize) throw new MessageSizeException();
>> +            if (m_maxMessageSizeBytes != 0 && 
>> m_maxMessageSizeBytes*1024 < bodySize) throw new MessageSizeException();
>>          } catch (MessageSizeException e) {
>>              throw new MessagingException("message size exception is 
>> nested", e);
>>          }


---------------------------------------------------------------------
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