camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1324676 - in /camel/branches/camel-2.9.x: ./ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/test/java/org/apache/camel/issues/ components/camel-mail/src/main/java/org/apache/camel/component/mail/ components/camel-mail/src/t...
Date Wed, 11 Apr 2012 09:47:48 GMT
Author: davsclaus
Date: Wed Apr 11 09:47:48 2012
New Revision: 1324676

URL: http://svn.apache.org/viewvc?rev=1324676&view=rev
Log:
CAMEL-5157: Fixed camel-mail issue with attachments may not appear when doing redelivery.
Fixed by ensuring MailMessage always populate attachments, to preserve them when error handler
perfroms defensive copy of the MailMessage.

Added:
    camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/issues/MessageWithAttachmentRedeliveryIssueTest.java
      - copied unchanged from r1324675, camel/trunk/camel-core/src/test/java/org/apache/camel/issues/MessageWithAttachmentRedeliveryIssueTest.java
    camel/branches/camel-2.9.x/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailAttachmentRedeliveryTest.java
      - copied unchanged from r1324675, camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailAttachmentRedeliveryTest.java
Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java
    camel/branches/camel-2.9.x/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailMessage.java

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1324675

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java?rev=1324676&r1=1324675&r2=1324676&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java
(original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java
Wed Apr 11 09:47:48 2012
@@ -288,6 +288,9 @@ public class DefaultMessage extends Mess
     }
 
     public boolean hasAttachments() {
+        // optimized to avoid calling createAttachments as that creates a new empty map
+        // that we 99% do not need (only camel-mail supports attachments), and we have
+        // then ensure camel-mail always creates attachments to remedy for this
         return this.attachments != null && this.attachments.size() > 0;
     }
 

Modified: camel/branches/camel-2.9.x/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailMessage.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailMessage.java?rev=1324676&r1=1324675&r2=1324676&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailMessage.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailMessage.java
Wed Apr 11 09:47:48 2012
@@ -56,6 +56,10 @@ public class MailMessage extends Default
         MailMessage answer = (MailMessage)super.copy();
         answer.originalMailMessage = originalMailMessage;
         answer.mailMessage = mailMessage;
+        // force attachments to be created (by getting attachments) to ensure they are always
available due Camel error handler
+        // makes defensive copies, and we have optimized it to avoid populating initial attachments,
when not needed,
+        // as all other Camel components do not use attachments
+        getAttachments();
         return answer;
     }
 



Mime
View raw message