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 rd...@apache.org on 2009/03/24 15:17:20 UTC

svn commit: r757815 - in /james/protocols/imap/trunk: deployment/src/test/java/org/apache/james/imap/functional/ImapHostSystem.java seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java

Author: rdonkin
Date: Tue Mar 24 14:17:17 2009
New Revision: 757815

URL: http://svn.apache.org/viewvc?rev=757815&view=rev
Log:
Use session log in handler IMAP-75 https://issues.apache.org/jira/browse/IMAP-75

Modified:
    james/protocols/imap/trunk/deployment/src/test/java/org/apache/james/imap/functional/ImapHostSystem.java
    james/protocols/imap/trunk/seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java

Modified: james/protocols/imap/trunk/deployment/src/test/java/org/apache/james/imap/functional/ImapHostSystem.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/deployment/src/test/java/org/apache/james/imap/functional/ImapHostSystem.java?rev=757815&r1=757814&r2=757815&view=diff
==============================================================================
--- james/protocols/imap/trunk/deployment/src/test/java/org/apache/james/imap/functional/ImapHostSystem.java (original)
+++ james/protocols/imap/trunk/deployment/src/test/java/org/apache/james/imap/functional/ImapHostSystem.java Tue Mar 24 14:17:17 2009
@@ -113,8 +113,8 @@
             out = new ByteBufferOutputStream(continuation);
             in = new ByteBufferInputStream();
             handler = new ImapRequestHandler(decoder, processor, encoder);
-            handler.setLog(new SilentLog());
             session = new ImapSessionImpl();
+            session.setLog(new SilentLog());
         }
 
         public String readLine() throws Exception {

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=757815&r1=757814&r2=757815&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 Tue Mar 24 14:17:17 2009
@@ -24,7 +24,6 @@
 import java.io.OutputStream;
 
 import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.james.imap.api.ImapMessage;
 import org.apache.james.imap.api.ImapSessionState;
 import org.apache.james.imap.api.message.response.ImapResponseMessage;
@@ -51,11 +50,6 @@
             'E', ' ', 'S', 'e', 'l', 'e', 'c', 't', 'e', 'd', ' ', 'm', 'a',
             'i', 'l', 'b', 'o', 'x', ' ', 'h', 'a', 's', ' ', 'b', 'e', 'e',
             'n', ' ', 'd', 'e', 'l', 'e', 't', 'e', 'd', '\r', '\n' };
-
-    private static final Log IMAP_LOG = LogFactory.getLog("org.apache.james.imap");
-    
-    private Log log = IMAP_LOG;
-
     
     private final ImapDecoder decoder;
 
@@ -70,14 +64,6 @@
         this.encoder = encoder;
     }
 
-    public Log getLog() {
-        return log;
-    }
-
-    public void setLog(Log log) {
-        this.log = log;
-    }
-
     /**
      * This method parses IMAP commands read off the wire in handleConnection.
      * Actual processing of the command (possibly including additional back and
@@ -93,13 +79,13 @@
             ImapSession session) {
         final boolean result;
         if (isSelectedMailboxDeleted(session)) {
-            writeSignoff(output);
+            writeSignoff(output, session);
             result = false;
         } else {
             ImapRequestLineReader request = new ImapRequestLineReader(input,
                     output);
 
-            final Log logger = getLog();
+            final Log logger = session.getLog();
             try {
                 request.nextChar();
             } catch (ProtocolException e) {
@@ -140,12 +126,12 @@
         return result;
     }
 
-    private void writeSignoff(OutputStream output) {
+    private void writeSignoff(OutputStream output, ImapSession session) {
         try {
             output.write(MAILBOX_DELETED_SIGNOFF);
         } catch (IOException e) {
-            getLog().warn("Failed to write signoff");
-            getLog().debug("Failed to write signoff:", e);
+            session.getLog().warn("Failed to write signoff");
+            session.getLog().debug("Failed to write signoff:", e);
         }
     }
 
@@ -165,13 +151,13 @@
             try {
                 session.logout();
             } catch (Throwable t) {
-                getLog().warn("Session logout failed. Resources may not be correctly recycled.");
+                session.getLog().warn("Session logout failed. Resources may not be correctly recycled.");
             }
         }
         try {
             out.write(ABANDON_SIGNOFF);
         } catch (Throwable t) {
-            getLog().debug("Failed to write ABANDON_SIGNOFF", t);
+            session.getLog().debug("Failed to write ABANDON_SIGNOFF", t);
         }
     }
 
@@ -187,7 +173,7 @@
             result = true;
         } else {
             result = false;
-            final Log logger = getLog();
+            final Log logger = session.getLog();
             logger.info(failure.getMessage());
             if (logger.isDebugEnabled()) {
                 logger.debug("Failed to write " + message, failure);



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