james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1052179 - /james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/core/ExtraDotInputStream.java
Date Thu, 23 Dec 2010 06:35:13 GMT
Author: norman
Date: Thu Dec 23 06:35:12 2010
New Revision: 1052179

URL: http://svn.apache.org/viewvc?rev=1052179&view=rev
Log:
Make sure ExtraDotInputStream copy left buffer data on CRLFCRLF. See JAMES-1152

Modified:
    james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/core/ExtraDotInputStream.java

Modified: james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/core/ExtraDotInputStream.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/core/ExtraDotInputStream.java?rev=1052179&r1=1052178&r2=1052179&view=diff
==============================================================================
--- james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/core/ExtraDotInputStream.java
(original)
+++ james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/core/ExtraDotInputStream.java
Thu Dec 23 06:35:12 2010
@@ -70,7 +70,19 @@ public class ExtraDotInputStream extends
         
         if (startLine) {
             int i = 0;
-            while (i < 3) {
+            // check if we still have something in the buffer
+            // if so we need to copy it so we don't lose data
+            
+            // See JAMES-1152
+            if (pos != -1 && pos != 0) {
+                byte[] tmpBuf = new byte[3];
+                while(pos < buf.length) {
+                    tmpBuf[i++] = buf[pos++];
+                }
+                
+                buf = tmpBuf;
+            }
+            while (i < buf.length) {
                 buf[i++] = (byte) in.read();
             }
             if (buf[0] == '.' && buf[1] == '\r' && buf[2] ==  '\n') {



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