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 no...@apache.org on 2010/02/06 19:16:10 UTC

svn commit: r907264 - /james/server/trunk/mina-socket/src/main/java/org/apache/james/socket/mina/codec/CRLFTerminatedLineDecoder.java

Author: norman
Date: Sat Feb  6 18:16:09 2010
New Revision: 907264

URL: http://svn.apache.org/viewvc?rev=907264&view=rev
Log:
fix the LineLengthExceedException throwing

Modified:
    james/server/trunk/mina-socket/src/main/java/org/apache/james/socket/mina/codec/CRLFTerminatedLineDecoder.java

Modified: james/server/trunk/mina-socket/src/main/java/org/apache/james/socket/mina/codec/CRLFTerminatedLineDecoder.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mina-socket/src/main/java/org/apache/james/socket/mina/codec/CRLFTerminatedLineDecoder.java?rev=907264&r1=907263&r2=907264&view=diff
==============================================================================
--- james/server/trunk/mina-socket/src/main/java/org/apache/james/socket/mina/codec/CRLFTerminatedLineDecoder.java (original)
+++ james/server/trunk/mina-socket/src/main/java/org/apache/james/socket/mina/codec/CRLFTerminatedLineDecoder.java Sat Feb  6 18:16:09 2010
@@ -49,9 +49,7 @@
      */
     protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception {
        
-        if (maxLineLength != -1 && in.capacity() > maxLineLength) {
-            throw new LineLengthExceededException(maxLineLength, in.capacity());
-        }
+      
 
         // Remember the initial position.
         int start = in.position();
@@ -59,9 +57,15 @@
         
         // Now find the first CRLF in the buffer.
         byte previous = 0;
+        int count = 0;
         while (in.hasRemaining()) {
             byte current = in.get();
-
+            count++;
+            
+            if (maxLineLength != -1 && count > maxLineLength) {
+                throw new LineLengthExceededException(maxLineLength, in.capacity());
+            }
+            
             if (previous == '\r' && current == '\n') {
                 // Remember the current position and limit.
                 int position = in.position();



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