This is an automated email from the ASF dual-hosted git repository.
ijokarumawak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/master by this push:
new 08fe648 [NIFI-6374] ConsumeEWS fails when email attachment has no
content type - ensure non null content type
08fe648 is described below
commit 08fe648b1c61ba38d6332661219ebeaf67c3486b
Author: JF Beauvais <[email protected]>
AuthorDate: Mon Jul 22 10:36:26 2019 +0200
[NIFI-6374] ConsumeEWS fails when email attachment has no content type -
ensure non null content type
This closes #3596.
Signed-off-by: Koji Kawamura <[email protected]>
---
.../src/main/java/org/apache/nifi/processors/email/ConsumeEWS.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git
a/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/ConsumeEWS.java
b/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/ConsumeEWS.java
index 462f405..aeeb5ee 100644
---
a/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/ConsumeEWS.java
+++
b/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/ConsumeEWS.java
@@ -454,7 +454,8 @@ public class ConsumeEWS extends AbstractProcessor {
FileAttachment file = (FileAttachment)x;
file.load();
- ByteArrayDataSource bds = new
ByteArrayDataSource(file.getContent(), file.getContentType());
+ String type = file.getContentType() == null ? "text/plain"
: file.getContentType();
+ ByteArrayDataSource bds = new
ByteArrayDataSource(file.getContent(), type);
mm.attach(bds,file.getName(), "",
EmailAttachment.ATTACHMENT);
} catch (MessagingException e) {