Author: joachim
Date: Tue Nov 21 00:16:33 2006
New Revision: 477572

URL: http://svn.apache.org/viewvc?view=rev&rev=477572
Log:
- log caught ProtocolException to debug
- embed caucht Exceptions into ProtocolException
- possible solution for JAMES-709
thanks to Robert Burrell Donkin for reporting the issue

Modified:
    
james/server/trunk/src/java/org/apache/james/imapserver/ImapRequestHandler.java
    
james/server/trunk/src/java/org/apache/james/imapserver/ImapRequestLineReader.java

Modified: 
james/server/trunk/src/java/org/apache/james/imapserver/ImapRequestHandler.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/imapserver/ImapRequestHandler.java?view=diff&rev=477572&r1=477571&r2=477572
==============================================================================
--- 
james/server/trunk/src/java/org/apache/james/imapserver/ImapRequestHandler.java 
(original)
+++ 
james/server/trunk/src/java/org/apache/james/imapserver/ImapRequestHandler.java 
Tue Nov 21 00:16:33 2006
@@ -46,7 +46,7 @@
     }
     
     /**
-     * This method parses POP3 commands read off the wire in handleConnection.
+     * This method parses IMAP commands read off the wire in handleConnection.
      * Actual processing of the command (possibly including additional back and
      * forth communication with the client) is delegated to one of a number of
      * command specific handler methods.  The primary purpose of this method is
@@ -61,10 +61,13 @@
             throws ProtocolException
     {
         ImapRequestLineReader request = new ImapRequestLineReader( input, 
output );
+        setupLogger(request);
+        
         try {
             request.nextChar();
         }
         catch ( ProtocolException e ) {
+            getLogger().debug("Cannot handling request: ", e);
             return false;
         }
 

Modified: 
james/server/trunk/src/java/org/apache/james/imapserver/ImapRequestLineReader.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/imapserver/ImapRequestLineReader.java?view=diff&rev=477572&r1=477571&r2=477572
==============================================================================
--- 
james/server/trunk/src/java/org/apache/james/imapserver/ImapRequestLineReader.java
 (original)
+++ 
james/server/trunk/src/java/org/apache/james/imapserver/ImapRequestLineReader.java
 Tue Nov 21 00:16:33 2006
@@ -23,6 +23,8 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+
 /**
  * Wraps the client input reader with a bunch of convenience methods, allowing 
lookahead=1
  * on the underlying character stream.
@@ -30,7 +32,7 @@
  *
  * @version $Revision: 109034 $
  */
-public class ImapRequestLineReader
+public class ImapRequestLineReader extends AbstractLogEnabled
 {
     private InputStream input;
     private OutputStream output;
@@ -61,7 +63,7 @@
         }
 
         if ( next == '\r' || next == '\n' ) {
-            throw new ProtocolException( "Missing argument." );
+            throw new ProtocolException( "Missing argument. (read \\n or \\r)" 
);
         }
 
         return next;
@@ -82,7 +84,7 @@
                 next = input.read();
             }
             catch ( IOException e ) {
-                throw new ProtocolException( "Error reading from stream." );
+                throw new ProtocolException( "Error reading from stream.", e);
             }
             if ( next == -1 ) {
                 throw new ProtocolException( "Unexpected end of stream." );
@@ -119,8 +121,7 @@
 
         // Check if we found extra characters.
         if ( next != '\n' ) {
-            // TODO debug log here and other exceptions
-            throw new ProtocolException( "Expected end-of-line, found more 
characters.");
+            throw new ProtocolException( "Expected end-of-line, found more 
characters. ("+((int)next)+")");
         }
     }
 
@@ -157,7 +158,7 @@
                 int count = 0;
                 count = input.read( holder, readTotal, holder.length - 
readTotal );
                 if ( count == -1 ) {
-                    throw new ProtocolException( "Unexpectd end of stream." );
+                    throw new ProtocolException( "Unexpected end of stream." );
                 }
                 readTotal += count;
             }
@@ -166,7 +167,7 @@
             nextChar = 0;
         }
         catch ( IOException e ) {
-            throw new ProtocolException( "Error reading from stream." );
+            throw new ProtocolException( "Error reading from stream." , e);
         }
 
     }
@@ -185,7 +186,7 @@
             output.flush();
         }
         catch ( IOException e ) {
-            throw new ProtocolException("Unexpected exception in sending 
command continuation request.");
+            throw new ProtocolException("Unexpected exception in sending 
command continuation request.", e);
         }
     }
 



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

Reply via email to