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 2005/05/05 04:23:43 UTC

svn commit: r168238 - /james/server/branches/merge_v2_and_trunk/src/java/org/apache/james/core/MimeMessageWrapper.java

Author: noel
Date: Wed May  4 19:23:42 2005
New Revision: 168238

URL: http://svn.apache.org/viewcvs?rev=168238&view=rev
Log:
revision 109187 introduced a bug where if we had a real Return-Path header its value would not be the first in the String[].  This tries to eliminate that problem.  We should still test to see if this hack is necessary at all, or if InternetHeaders.setHeader("Return-Path", <value>) is smart enough in JavaMail 1.3.2 to put the header at the top, instead of in the middle.

Modified:
    james/server/branches/merge_v2_and_trunk/src/java/org/apache/james/core/MimeMessageWrapper.java

Modified: james/server/branches/merge_v2_and_trunk/src/java/org/apache/james/core/MimeMessageWrapper.java
URL: http://svn.apache.org/viewcvs/james/server/branches/merge_v2_and_trunk/src/java/org/apache/james/core/MimeMessageWrapper.java?rev=168238&r1=168237&r2=168238&view=diff
==============================================================================
--- james/server/branches/merge_v2_and_trunk/src/java/org/apache/james/core/MimeMessageWrapper.java (original)
+++ james/server/branches/merge_v2_and_trunk/src/java/org/apache/james/core/MimeMessageWrapper.java Wed May  4 19:23:42 2005
@@ -104,9 +104,23 @@
     }
 
     private synchronized MailHeaders loadHeaders(InputStream is) throws MessagingException {
+
+        /* InternetHeaders can be a bit awkward to work with due to
+         * its own internal handling of header order.  This hack may
+         * not always be necessary, but for now we are trying to
+         * ensure that there is a Return-Path header, even if just a
+         * placeholder, so that later, e.g., in LocalDelivery, when we
+         * call setHeader, it will remove any other Return-Path
+         * headers, and ensure that ours is on the top. addHeader
+         * handles header order, but not setHeader. This may change in
+         * future JavaMail.  But if there are other Return-Path header
+         * values, let's drop our placeholder. */
+
         headers = new MailHeaders(new ByteArrayInputStream((RFC2822Headers.RETURN_PATH + ": placeholder").getBytes()));
         headers.setHeader(RFC2822Headers.RETURN_PATH, null);
         headers.load(is);
+        String[] returnPathHeaders = headers.getHeader(RFC2822Headers.RETURN_PATH);
+        if (returnPathHeaders.length > 1) headers.setHeader(RFC2822Headers.RETURN_PATH, returnPathHeaders[1]);
         return headers;
     }
 



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