Author: rdonkin
Date: Thu Aug  2 12:55:39 2007
New Revision: 562232

URL: http://svn.apache.org/viewvc?view=rev&rev=562232
Log:
Improved error reporting.

Modified:
    
james/server/trunk/core-library/src/main/java/org/apache/james/mailrepository/AvalonMailRepository.java
    
james/server/trunk/core-library/src/main/java/org/apache/james/mailrepository/JDBCMailRepository.java

Modified: 
james/server/trunk/core-library/src/main/java/org/apache/james/mailrepository/AvalonMailRepository.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/core-library/src/main/java/org/apache/james/mailrepository/AvalonMailRepository.java?view=diff&rev=562232&r1=562231&r2=562232
==============================================================================
--- 
james/server/trunk/core-library/src/main/java/org/apache/james/mailrepository/AvalonMailRepository.java
 (original)
+++ 
james/server/trunk/core-library/src/main/java/org/apache/james/mailrepository/AvalonMailRepository.java
 Thu Aug  2 12:55:39 2007
@@ -235,7 +235,9 @@
                             .append(", so we're deleting it.");
                     remove(key);
                 }
-                getLogger().warn(exceptionBuffer.toString());
+                final String errorMessage = exceptionBuffer.toString();
+                getLogger().warn(errorMessage);
+                getLogger().debug(errorMessage, re);
                 return null;
             }
             MimeMessageAvalonSource source = new 
MimeMessageAvalonSource(streamRepository, destination, key);
@@ -244,7 +246,7 @@
             return mc;
         } catch (Exception me) {
             getLogger().error("Exception retrieving mail: " + me);
-            throw new MessagingException("Exception while retrieving mail: " + 
me.getMessage());
+            throw new MessagingException("Exception while retrieving mail: " + 
me.getMessage(), me);
         }
     }
 

Modified: 
james/server/trunk/core-library/src/main/java/org/apache/james/mailrepository/JDBCMailRepository.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/core-library/src/main/java/org/apache/james/mailrepository/JDBCMailRepository.java?view=diff&rev=562232&r1=562231&r2=562232
==============================================================================
--- 
james/server/trunk/core-library/src/main/java/org/apache/james/mailrepository/JDBCMailRepository.java
 (original)
+++ 
james/server/trunk/core-library/src/main/java/org/apache/james/mailrepository/JDBCMailRepository.java
 Thu Aug  2 12:55:39 2007
@@ -667,6 +667,7 @@
             conn.commit();
             conn.setAutoCommit(true);
         } catch (SQLException e) {
+            getLogger().debug("Failed to store internal mail", e);
             throw new IOException(e.getMessage());
         } finally {
             theJDBCUtil.closeJDBCConnection(conn);
@@ -811,9 +812,10 @@
                                         .append(sqle.getSQLState())
                                         .append(sqle.getNextException());
             getLogger().error(errorBuffer.toString());
-            throw new MessagingException("Exception while retrieving mail: " + 
sqle.getMessage());
+            getLogger().debug("Failed to retrieve mail", sqle);
+            throw new MessagingException("Exception while retrieving mail: " + 
sqle.getMessage(), sqle);
         } catch (Exception me) {
-            throw new MessagingException("Exception while retrieving mail: " + 
me.getMessage());
+            throw new MessagingException("Exception while retrieving mail: " + 
me.getMessage(), me);
         } finally {
             theJDBCUtil.closeJDBCResultSet(rsMessage);
             theJDBCUtil.closeJDBCStatement(retrieveMessage);
@@ -839,7 +841,7 @@
                 sr.remove(key);
             }
         } catch (Exception me) {
-            throw new MessagingException("Exception while removing mail: " + 
me.getMessage());
+            throw new MessagingException("Exception while removing mail: " + 
me.getMessage(), me);
         } finally {
             theJDBCUtil.closeJDBCStatement(removeMessage);
             theJDBCUtil.closeJDBCConnection(conn);
@@ -867,7 +869,7 @@
             }
             return messageList.iterator();
         } catch (Exception me) {
-            throw new MessagingException("Exception while listing mail: " + 
me.getMessage());
+            throw new MessagingException("Exception while listing mail: " + 
me.getMessage(), me);
         } finally {
             theJDBCUtil.closeJDBCResultSet(rsListMessages);
             theJDBCUtil.closeJDBCStatement(listMessages);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to