nifi-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (NIFI-4326) ExtractEmailHeaders.java unhandled Exceptions
Date Fri, 01 Sep 2017 12:40:00 GMT

    [ https://issues.apache.org/jira/browse/NIFI-4326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16150444#comment-16150444
] 

ASF GitHub Bot commented on NIFI-4326:
--------------------------------------

Github user btwood commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2111#discussion_r136565224
  
    --- Diff: nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/ExtractEmailAttachments.java
---
    @@ -131,11 +132,15 @@ public void process(final InputStream rawIn) throws IOException
{
                             MimeMessageParser parser = new MimeMessageParser(originalMessage).parse();
                             // RFC-2822 determines that a message must have a "From:" header
                             // if a message lacks the field, it is flagged as invalid
    -                        Address[] from = originalMessage.getFrom();
    +                        if (InternetAddress.parseHeader(originalMessage.getHeader("From",
","), false) == null) {
    +                            if (InternetAddress.parseHeader(originalMessage.getHeader("Sender",
","), false) == null) {
    --- End diff --
    
    I have a large corpus of mail to search for that. I can search for messages with a "Sender"
header. The reason I did this however was to try and mimic "getFrom()" but without using the
"strict" setting. So this is basically does the same thing getFrom() does, manually.
    
    I was using the following grepcode for a closer look:
    http://grepcode.com/file/repo1.maven.org/maven2/org.apache.geronimo.specs/geronimo-javamail_1.4_spec/1.1/javax/mail/internet/MimeMessage.java#MimeMessage.getFrom%28%29
    
    I guess the caveat there is that geronimo-javamail may be different implementation than
openJDK javamail.
    
    The mail server may not be the one setting the From/Sender header. That is often decided
by the client. I suppose a sufficiently old mail client might set Sender instead. My understanding
from the code is that they were synonymous. I'll re-read the RFC to see if that is the case.



> ExtractEmailHeaders.java unhandled Exceptions
> ---------------------------------------------
>
>                 Key: NIFI-4326
>                 URL: https://issues.apache.org/jira/browse/NIFI-4326
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.3.0
>         Environment: jdk 1.8.0_121-b13
>            Reporter: Benjamin Wood
>            Priority: Minor
>             Fix For: 1.4.0
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> The ExtractEmailHeaders  processor throws a NullPointerException if there is no TO, CC,
and BCC recipients.
> If there are no recipients "originalMessage.getAllRecipients()" returns NULL, and not
a 0 length array.
> If an address is empty (<> or " ") then getRecipients() will throw an "Empty Address"
AddressException
> It's possible this is only an issue with Oracle Java.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message