GitHub user rpmiskin opened a pull request:

    https://github.com/apache/nifi/pull/187

    NIFI-1434 Prevent array index exception in PutEmail

    I've updated PutEmail to avoid an ArrayIndexOutOfBoundsException in the 
case where the FROM property evaluates to an empty string.
    
    Reading through code in MimeMessage, message.addFrom(InternetAddress[]) is 
equivalent to message.setFrom(String) in the case where the array has length 1 
and will clear the sender when the array has length 0 (rather than throwing an 
exception).
    
    I have not made any changes to TestPutEmail. To provide more complete 
testing I think it would be necessary to do a little refactoring to allow the 
static call to Transport.send() to be stubbed. Possibly introducing a 
PutEmail.send() method that would be overridden when testing?

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/rpmiskin/nifi NIFI-1434

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/187.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #187
    
----
commit 95c80b433056bd161c5ed64fa24186ac8b46485c
Author: Richard Miskin <[email protected]>
Date:   2016-01-24T09:07:57Z

    NIFI-1434 Prevent array index exception in PutEmail

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to