james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r754852 - /james/protocols/imap/trunk/seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java
Date Mon, 16 Mar 2009 08:59:41 GMT
Author: rdonkin
Date: Mon Mar 16 08:59:41 2009
New Revision: 754852

URL: http://svn.apache.org/viewvc?rev=754852&view=rev
Log:
Session needs to be logged out in all exit cases. IMAP-67 https://issues.apache.org/jira/browse/IMAP-67

Modified:
    james/protocols/imap/trunk/seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java

Modified: james/protocols/imap/trunk/seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java?rev=754852&r1=754851&r2=754852&view=diff
==============================================================================
--- james/protocols/imap/trunk/seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java
(original)
+++ james/protocols/imap/trunk/seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java
Mon Mar 16 08:59:41 2009
@@ -102,6 +102,7 @@
             } catch (ProtocolException e) {
                 logger.debug("Unexpected end of line. Cannot handle request: ",
                         e);
+                abandon(output, session);
                 return false;
             }
 
@@ -123,14 +124,13 @@
                         logger.info("Fault during clean up: " + e.getMessage());
                     }
                     logger.debug("Abandoning after fault in clean up", e);
-                    session.logout();
-                    abandon(output);
+                    abandon(output, session);
                 }
 
                 result = !(ImapSessionState.LOGOUT == session.getState());
             } else {
                 result = false;
-                abandon(output);
+                abandon(output, session);
             }
         }
         return result;
@@ -156,7 +156,14 @@
         return selectedMailboxIsDeleted;
     }
 
-    private void abandon(OutputStream out) {
+    private void abandon(OutputStream out, ImapSession session) {
+        if (session != null){
+            try {
+                session.logout();
+            } catch (Throwable t) {
+                getLog().warn("Session logout failed. Resources may not be correctly recycled.");
+            }
+        }
         try {
             out.write(ABANDON_SIGNOFF);
         } catch (Throwable t) {



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