You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by da...@apache.org on 2005/06/22 13:47:37 UTC

svn commit: r191808 - /james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java

Author: danny
Date: Wed Jun 22 04:47:36 2005
New Revision: 191808

URL: http://svn.apache.org/viewcvs?rev=191808&view=rev
Log:
OOM is not caught, but it is the cause of the RuntimeException which _is_ caught.

Modified:
    james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java

Modified: james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java?rev=191808&r1=191807&r2=191808&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java Wed Jun 22 04:47:36 2005
@@ -333,22 +333,19 @@
             MailImpl mc = null;
             try {
                 mc = (MailImpl) or.get(key);
-            } catch(OutOfMemoryError oome){
-                StringBuffer exceptionBuffer =
-                    new StringBuffer(128)
-                            .append("Out of memory when retrieving mail, not deleting: ")
-                            .append(oome.toString());
-                getLogger().warn(exceptionBuffer.toString());
-                return null;
-            }
-            catch (RuntimeException re) {
-                StringBuffer exceptionBuffer =
-                    new StringBuffer(128)
-                            .append("Exception retrieving mail: ")
+            } 
+            catch (RuntimeException re){
+                StringBuffer exceptionBuffer = new StringBuffer(128);
+                if(re.getCause() instanceof Error){
+                    exceptionBuffer.append("Error when retrieving mail, not deleting: ")
+                            .append(re.toString());
+                }else{
+                    exceptionBuffer.append("Exception retrieving mail: ")
                             .append(re.toString())
                             .append(", so we're deleting it.");
+                    remove(key);
+                }
                 getLogger().warn(exceptionBuffer.toString());
-                remove(key);
                 return null;
             }
             MimeMessageAvalonSource source = new MimeMessageAvalonSource(sr, destination, key);



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