You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Richard Miskin <r....@gmail.com> on 2016/01/24 19:39:08 UTC
Re: [jira] [Commented] (NIFI-1434) ArrayIndexOutOfBoundsException in PutEmail if property expansion fails for PutEmail.FROM
Hi,
The Travis build for this pull request failed, but only on OpenJDK7 and that was due to
"TestListenSyslog.testTCPSingleConnection:166 » ConcurrentModification"
I can’t see how that can be related to my change - any ideas?
It looks like a delay was added to that test as part of NIFi-1145, might it need to be increased?
Cheers,
Richard
> On 24 Jan 2016, at 09:39, ASF GitHub Bot (JIRA) <ji...@apache.org> wrote:
>
>
> [ https://issues.apache.org/jira/browse/NIFI-1434?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15114253#comment-15114253 ]
>
> ASF GitHub Bot commented on NIFI-1434:
> --------------------------------------
>
> 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 <r....@gmail.com>
> Date: 2016-01-24T09:07:57Z
>
> NIFI-1434 Prevent array index exception in PutEmail
>
> ----
>
>
>> 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)
Re: [jira] [Commented] (NIFI-1434) ArrayIndexOutOfBoundsException in PutEmail if property expansion fails for PutEmail.FROM
Posted by Richard Miskin <r....@gmail.com>.
Thanks for looking into this.
Cheers,
Richard
> On 25 Jan 2016, at 13:48, Bryan Bende <bb...@gmail.com> wrote:
>
> Richard,
>
> I agree with you that it does not appear to be related to your change.
>
> I'm taking a look at the ListenSyslog test.
>
> -Bryan
>
> On Sun, Jan 24, 2016 at 1:39 PM, Richard Miskin <r....@gmail.com>
> wrote:
>
>> Hi,
>>
>> The Travis build for this pull request failed, but only on OpenJDK7 and
>> that was due to
>> "TestListenSyslog.testTCPSingleConnection:166 » ConcurrentModification"
>>
>> I can’t see how that can be related to my change - any ideas?
>>
>> It looks like a delay was added to that test as part of NIFi-1145, might
>> it need to be increased?
>>
>> Cheers,
>> Richard
>>
>>
>>> On 24 Jan 2016, at 09:39, ASF GitHub Bot (JIRA) <ji...@apache.org> wrote:
>>>
>>>
>>> [
>> https://issues.apache.org/jira/browse/NIFI-1434?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15114253#comment-15114253
>> ]
>>>
>>> ASF GitHub Bot commented on NIFI-1434:
>>> --------------------------------------
>>>
>>> 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 <r....@gmail.com>
>>> Date: 2016-01-24T09:07:57Z
>>>
>>> NIFI-1434 Prevent array index exception in PutEmail
>>>
>>> ----
>>>
>>>
>>>> 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)
>>
>>
Re: [jira] [Commented] (NIFI-1434) ArrayIndexOutOfBoundsException in
PutEmail if property expansion fails for PutEmail.FROM
Posted by Bryan Bende <bb...@gmail.com>.
Richard,
I agree with you that it does not appear to be related to your change.
I'm taking a look at the ListenSyslog test.
-Bryan
On Sun, Jan 24, 2016 at 1:39 PM, Richard Miskin <r....@gmail.com>
wrote:
> Hi,
>
> The Travis build for this pull request failed, but only on OpenJDK7 and
> that was due to
> "TestListenSyslog.testTCPSingleConnection:166 » ConcurrentModification"
>
> I can’t see how that can be related to my change - any ideas?
>
> It looks like a delay was added to that test as part of NIFi-1145, might
> it need to be increased?
>
> Cheers,
> Richard
>
>
> > On 24 Jan 2016, at 09:39, ASF GitHub Bot (JIRA) <ji...@apache.org> wrote:
> >
> >
> > [
> https://issues.apache.org/jira/browse/NIFI-1434?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15114253#comment-15114253
> ]
> >
> > ASF GitHub Bot commented on NIFI-1434:
> > --------------------------------------
> >
> > 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 <r....@gmail.com>
> > Date: 2016-01-24T09:07:57Z
> >
> > NIFI-1434 Prevent array index exception in PutEmail
> >
> > ----
> >
> >
> >> 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)
>
>