james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan Schiessling...@rapi.com>
Subject Bug in MimeMessageSource results in countless open streams
Date Fri, 03 May 2002 21:10:50 GMT

After my mailbox was filled with about 900 emails, I could not get
these emails by pop3.

The reason: Could not open file, because
too many open file descriptors were already opened.
For each email in the users mailbox, two streams were opened
(but not closed) (The streams werde opened for
determining the length of the email).

To fix this problem:

In the source file
replace the method

public long getMessageSize() throws IOException{


public long getMessageSize() throws IOException {
         int size = 0;
         InputStream in = null;
         try {
             in = getInputStream();
             int read = 0;
             byte[] data = new byte[1024];
             while ((read = in.read(data)) > 0) {
                 size += read;
         } finally {
             if (in != null) in.close();
         return size;

Here the InputStream "in" will be closed. This should fix the problem.


Stephan Schiessling

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

View raw message