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

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

Github user rpmiskin commented on the pull request:

    https://github.com/apache/nifi/pull/187#issuecomment-176588865
  
    @JPercivall
    I believe SMTPTransport will pick up the from address from a couple of 
other places in preference to the FROM header, so I don't think it should 
necessarily be required.
    
    From com.sun.mail.smtp.SMTPTransport.mailFrom():
    
        Issue the MAIL FROM: command to start sending a message.
        Gets the sender's address in the following order:
        SMTPMessage.getEnvelopeFrom()
        mail.smtp.from property
        From: header in the message
        System username using the InternetAddress.getLocalAddress() method
    
    How about I update it so that the FROM property descriptor is optional, but 
if it is set it must evaluate to  a valid InternetAddress? Should the same 
logic be applied to the other InternetAddress values?
    
    Thanks for creating the other jira issue, I'll add some tests as part of my 
change but probably won't look to get 100% coverage of existing functionality.


> ArrayIndexOutOfBoundsException in PutEmail if property expansion fails for 
> PutEmail.FROM
> ----------------------------------------------------------------------------------------
>
>                 Key: NIFI-1434
>                 URL: https://issues.apache.org/jira/browse/NIFI-1434
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 0.4.1
>            Reporter: Richard Miskin
>
> If the FROM property in PutEmail evaluates to an empty string an 
> ArrayIndexOutOfBoundsException is thrown from the following code:
> {code:java}
> message.setFrom(InternetAddress.parse(context.getProperty(FROM)
>                  .evaluateAttributeExpressions(flowFile).getValue())[0]);
> {code}
> This leads to the FlowFile not being transferred to the REL_FAILURE 
> relationship and the exception propagates out of the onTrigger method.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to