NIFI-6695: ExtractEmailAttachments/ExtractEmailHeaders should not validate 'SendDate'

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #3757.
This commit is contained in:
archongum 2019-09-20 17:13:18 +08:00 committed by Pierre Villard
parent c7a2885c0c
commit aba450d658
No known key found for this signature in database
GPG Key ID: BEE1599F0726E9CD
2 changed files with 1 additions and 12 deletions

View File

@ -22,7 +22,6 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@ -134,11 +133,6 @@ public class ExtractEmailAttachments extends AbstractProcessor {
if (from == null) {
throw new MessagingException("Message failed RFC-2822 validation: No Sender");
}
Date sentDate = originalMessage.getSentDate();
if (sentDate == null) {
// Throws MessageException due to lack of minimum required headers
throw new MessagingException("Message failed RFC2822 validation: No Sent Date");
}
originalFlowFilesList.add(originalFlowFile);
if (parser.hasAttachments()) {
final String originalFlowFileName = originalFlowFile.getAttribute(CoreAttributes.FILENAME.key());

View File

@ -23,7 +23,6 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
@ -178,11 +177,7 @@ public class ExtractEmailHeaders extends AbstractProcessor {
if (from == null) {
throw new MessagingException("Message failed RFC-2822 validation: No Sender");
}
Date sentDate = originalMessage.getSentDate();
if (sentDate == null ) {
// Throws MessageException due to lack of minimum required headers
throw new MessagingException("Message failed RFC-2822 validation: No Sent Date");
} else if (capturedHeadersList.size() > 0){
if (capturedHeadersList.size() > 0){
Enumeration headers = originalMessage.getAllHeaders();
while (headers.hasMoreElements()) {
Header header = (Header) headers.nextElement();