jump to article
...intermittent thoughts

How stupid

I just recognized a stupid bug - coded by myself! I have been working again on my java mail puller for Domino - which is working quite good at the moment. But there's one exception: The pulling stops somewhere while processing all my mails on the pop box. So I tried to find some catched exception I do not explicitly log. And then it hit me. I am counting down the total messages in my pop3 folder in the following loop:
 for ( int ii=1; ii<=folder.getMessageCount(); ii++ ) {
That's not really a good line of code - because it is not only quite inperformant (getMessageCount() is done on EVERY loop), it is also wrong in this case. Since mails can be removed inside the loop (which is currently always the case), getMessageCount() returns one less on every loop. Leading to a Loop which works on exactly the half of all mails - uhh did I say that this is stupid?

Add Comment
 
Subject:
   
Name:
E-mail:
Web Site:
 
Comment:  (No HTML - Links will be converted if prefixed http://)
 
Remember Me?