james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Danny Angus <Danny_An...@slc.co.uk>
Subject Re: svn commit: r191791 - /james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java
Date Wed, 22 Jun 2005 11:49:35 GMT
you're right, its the cause ("cause: java.lang.OutOfMemoryError")  that is
an OOME
However it is the responibility of the catch in AvalonMailRepository to
delete/not delete the mail,
so I've changed that to use the cause, and not delete the mail for _any_
Error.

This may result in the file leak returning, but only where there are Errors
_and_ orphan files.

I've commited the change for review.

d.

---
Danny Angus
Lead Technical Consultant
Front Office Development
4W
3257





|---------+---------------------------->
|         |           "Stefano Bagnara"|
|         |           <io@bago.org>    |
|         |                            |
|         |           22/06/2005 12:23 |
|         |           Please respond to|
|         |           "James Developers|
|         |           List"            |
|---------+---------------------------->
  >-------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                      
                                        |
  |       To:       "'James Developers List'" <server-dev@james.apache.org>        
                                              |
  |       cc:                                                                            
                                        |
  |       Subject:  Re: svn commit: r191791 -                                            
                                        |
  |        /james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java
                                |
  >-------------------------------------------------------------------------------------------------------------------------------|




OutOfMemoryError is not a RuntimeException but an Error, isn't it?

The debug was from that code but I think the exception was really a
RuntimeException and not an OutOfMemoryError: it probably was encapsulated
in a RuntimeException before.

Let's read the DEBUG log...

> DEBUG mailstore: Exception retrieving mail:
> java.lang.RuntimeException: Exception caught while retrieving an
> object, cause: java.lang.OutOfMemoryError, so we're deleting it...
> good riddance!

So the "re" caught is a Runtime and is created by the
File_Persistent_Object_Repository with this snippet:

catch( final Throwable e )
{
    throw new RuntimeException(
    "Exception caught while retrieving an object, cause: " + e.toString()
);
}

I think this patch is wrong (the OOME is not a RuntimeException!). You
should change the File_Persistent_Object_Repository.

Stefano

> james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMa
> +++ ilRepository.java Wed Jun 22 03:36:11 2005
> @@ -333,12 +333,20 @@
>              MailImpl mc = null;
>              try {
>                  mc = (MailImpl) or.get(key);
> -            } catch (RuntimeException re) {
> +            } catch(OutOfMemoryError oome){
> +                StringBuffer exceptionBuffer =
> +                    new StringBuffer(128)
> +                            .append("Exception retrieving mail: ")
> +                            .append(oome.toString());
> +                getLogger().debug(exceptionBuffer.toString());
> +                return null;
> +            }
> +            catch (RuntimeException re) {
>                  StringBuffer exceptionBuffer =
>                      new StringBuffer(128)
>                              .append("Exception retrieving mail: ")
>                              .append(re.toString())
> -                            .append(", so we're deleting
> it... good riddance!");
> +                            .append(", so we're deleting it.");
>                  getLogger().debug(exceptionBuffer.toString());
>                  remove(key);
>                  return null;


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




***************************************************************************
The information in this e-mail is confidential and for use by the addressee(s) only. If you
are not the intended recipient (or responsible for delivery of the message to the intended
recipient) please notify us immediately on 0141 306 2050 and delete the message from your
computer. You may not copy or forward it or use or disclose its contents to any other person.
As Internet communications are capable of data corruption Student Loans Company Limited does
not accept any  responsibility for changes made to this message after it was sent. For this
reason it may be inappropriate to rely on advice or opinions contained in an e-mail without
obtaining written confirmation of it. Neither Student Loans Company Limited or the sender
accepts any liability or responsibility for viruses as it is your responsibility to scan attachments
(if any). Opinions and views expressed in this e-mail are those of the sender and may not
reflect the opinions and views of The Student Loans Company Limit
 ed.

This footnote also confirms that this email message has been swept for the presence of computer
viruses.

**************************************************************************

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