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 2011/05/11 19:16:25 UTC

svn commit: r1101984 - /james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java

Author: norman
Date: Wed May 11 17:16:25 2011
New Revision: 1101984

URL: http://svn.apache.org/viewvc?rev=1101984&view=rev
Log:
Correctly handle of BODY[HEADER.FIELDS] in all cases. See IMAP-298

Modified:
    james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java?rev=1101984&r1=1101983&r2=1101984&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java Wed May 11 17:16:25 2011
@@ -278,10 +278,20 @@ public final class FetchResponseBuilder 
     private HeaderBodyElement headerBodyElement(final MessageResult messageResult, String name, List<MessageResult.Header> lines, final int[] path, final boolean isBase) throws MailboxException {
         final HeaderBodyElement result = new HeaderBodyElement(name, lines);
         // if the size is 2 we had found not header and just want to write the empty line with CLRF terminated
-        // so check no if there is a content for it. If not we MUST NOT write the empty line in any case
+        // so check if there is a content for it. If not we MUST NOT write the empty line in any case
         // as stated in rfc3501
         if (result.size() == 2) {
-            if (content(messageResult, name, path, isBase).size() <= 0) {
+            // Check if its base as this can give use a more  correctly working check
+            // to see if we need to write the newline out to the client. 
+            // This is related to IMAP-298
+            if (isBase) {
+                if (messageResult.getSize() - result.size() <= 0) {
+                    // Seems like this mail has no body 
+                    result.noBody();
+                }
+              
+            } else if (content(messageResult, name, path, isBase).size() <= 0) {
+                // Seems like this mail has no body 
                 result.noBody();
             }
         }



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