You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/02/07 15:53:20 UTC
svn commit: r1443519 - in /camel/branches/camel-2.9.x: ./
components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
Author: davsclaus
Date: Thu Feb 7 14:53:20 2013
New Revision: 1443519
URL: http://svn.apache.org/viewvc?rev=1443519&view=rev
Log:
CAMEL-6045: Fixed mail binding to extract attachments if disposition is null but fileName is given. Thanks to Christoph Giera for the patch.
Modified:
camel/branches/camel-2.9.x/ (props changed)
camel/branches/camel-2.9.x/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1443513
Merged /camel/branches/camel-2.10.x:r1443516
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.9.x/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java?rev=1443519&r1=1443518&r2=1443519&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java (original)
+++ camel/branches/camel-2.9.x/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java Thu Feb 7 14:53:20 2013
@@ -303,26 +303,25 @@ public class MailBinding {
extractAttachmentsFromMultipart((Multipart) part.getContent(), map);
} else {
String disposition = part.getDisposition();
+ String fileName = part.getFileName();
+
if (LOG.isTraceEnabled()) {
- LOG.trace("Part #{}: Disposition: {}", i, part.getDisposition());
+ LOG.trace("Part #{}: Disposition: {}", i, disposition);
LOG.trace("Part #{}: Description: {}", i, part.getDescription());
LOG.trace("Part #{}: ContentType: {}", i, part.getContentType());
- LOG.trace("Part #{}: FileName: {}", i, part.getFileName());
+ LOG.trace("Part #{}: FileName: {}", i, fileName);
LOG.trace("Part #{}: Size: {}", i, part.getSize());
LOG.trace("Part #{}: LineCount: {}", i, part.getLineCount());
}
- if (disposition != null && (disposition.equalsIgnoreCase(Part.ATTACHMENT) || disposition.equalsIgnoreCase(Part.INLINE))) {
- // only add named attachments
- String fileName = part.getFileName();
- if (fileName != null) {
- LOG.debug("Mail contains file attachment: " + fileName);
- if (!map.containsKey(fileName)) {
- // Parts marked with a disposition of Part.ATTACHMENT are clearly attachments
- map.put(fileName, part.getDataHandler());
- } else {
- LOG.warn("Cannot extract duplicate attachment: " + fileName);
- }
+ if ((disposition != null && (disposition.equalsIgnoreCase(Part.ATTACHMENT) || disposition.equalsIgnoreCase(Part.INLINE)))
+ || fileName != null) {
+ LOG.debug("Mail contains file attachment: {}", fileName);
+ if (!map.containsKey(fileName)) {
+ // Parts marked with a disposition of Part.ATTACHMENT are clearly attachments
+ map.put(fileName, part.getDataHandler());
+ } else {
+ LOG.warn("Cannot extract duplicate file attachment: {}.", fileName);
}
}
}