[jira] [Commented] (NIFI-5633) EL - allDelineatedValues can throw ArrayIndexOutOfBoundsException

2018-09-25 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot commented on NIFI-5633:
--

Github user asfgit closed the pull request at:

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


> EL - allDelineatedValues can throw ArrayIndexOutOfBoundsException
> -
>
> Key: NIFI-5633
> URL: https://issues.apache.org/jira/browse/NIFI-5633
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Reporter: Pierre Villard
>Assignee: Pierre Villard
>Priority: Minor
> Fix For: 1.8.0
>
>
> When running this unit test:
> {code:java}
> @Test
> public void testAllDelineatedValuesCount() {
> final Map attributes = new HashMap<>();
> final String query = "${allDelineatedValues('${test}', '/'):count()}";
> attributes.put("test", "/");
> assertEquals(ResultType.WHOLE_NUMBER, Query.getResultType(query));
> assertEquals("0", Query.evaluateExpressions(query, attributes, null));
> }
> {code}
> This will throw:
> {noformat}
> java.lang.ArrayIndexOutOfBoundsException: 0
>   at 
> org.apache.nifi.attribute.expression.language.evaluation.selection.DelineatedAttributeEvaluator.evaluate(DelineatedAttributeEvaluator.java:65)
>   at 
> org.apache.nifi.attribute.expression.language.evaluation.reduce.CountEvaluator.evaluate(CountEvaluator.java:38)
>   at 
> org.apache.nifi.attribute.expression.language.evaluation.selection.MappingEvaluator.evaluate(MappingEvaluator.java:38)
>   at 
> org.apache.nifi.attribute.expression.language.Query.evaluate(Query.java:363)
>   at 
> org.apache.nifi.attribute.expression.language.Query.evaluateExpression(Query.java:204)
>   at 
> org.apache.nifi.attribute.expression.language.CompiledExpression.evaluate(CompiledExpression.java:58)
>   at 
> org.apache.nifi.attribute.expression.language.StandardPreparedQuery.evaluateExpressions(StandardPreparedQuery.java:51)
>   at 
> org.apache.nifi.attribute.expression.language.StandardPreparedQuery.evaluateExpressions(StandardPreparedQuery.java:64)
>   at 
> org.apache.nifi.attribute.expression.language.Query.evaluateExpressions(Query.java:223)
>   at 
> org.apache.nifi.attribute.expression.language.TestQuery.testAllDelineatedValuesCount(TestQuery.java:1033)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
>   at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>   at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
>   at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>   at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>   at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
>   at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
>   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>   at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>   at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
>   at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (NIFI-5633) EL - allDelineatedValues can throw ArrayIndexOutOfBoundsException

2018-09-25 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot commented on NIFI-5633:
--

Github user markap14 commented on the issue:

https://github.com/apache/nifi/pull/3029
  
@pvillard31 thanks for the fix and for providing great test cases! +1 
merged to master.


> EL - allDelineatedValues can throw ArrayIndexOutOfBoundsException
> -
>
> Key: NIFI-5633
> URL: https://issues.apache.org/jira/browse/NIFI-5633
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Reporter: Pierre Villard
>Assignee: Pierre Villard
>Priority: Minor
>
> When running this unit test:
> {code:java}
> @Test
> public void testAllDelineatedValuesCount() {
> final Map attributes = new HashMap<>();
> final String query = "${allDelineatedValues('${test}', '/'):count()}";
> attributes.put("test", "/");
> assertEquals(ResultType.WHOLE_NUMBER, Query.getResultType(query));
> assertEquals("0", Query.evaluateExpressions(query, attributes, null));
> }
> {code}
> This will throw:
> {noformat}
> java.lang.ArrayIndexOutOfBoundsException: 0
>   at 
> org.apache.nifi.attribute.expression.language.evaluation.selection.DelineatedAttributeEvaluator.evaluate(DelineatedAttributeEvaluator.java:65)
>   at 
> org.apache.nifi.attribute.expression.language.evaluation.reduce.CountEvaluator.evaluate(CountEvaluator.java:38)
>   at 
> org.apache.nifi.attribute.expression.language.evaluation.selection.MappingEvaluator.evaluate(MappingEvaluator.java:38)
>   at 
> org.apache.nifi.attribute.expression.language.Query.evaluate(Query.java:363)
>   at 
> org.apache.nifi.attribute.expression.language.Query.evaluateExpression(Query.java:204)
>   at 
> org.apache.nifi.attribute.expression.language.CompiledExpression.evaluate(CompiledExpression.java:58)
>   at 
> org.apache.nifi.attribute.expression.language.StandardPreparedQuery.evaluateExpressions(StandardPreparedQuery.java:51)
>   at 
> org.apache.nifi.attribute.expression.language.StandardPreparedQuery.evaluateExpressions(StandardPreparedQuery.java:64)
>   at 
> org.apache.nifi.attribute.expression.language.Query.evaluateExpressions(Query.java:223)
>   at 
> org.apache.nifi.attribute.expression.language.TestQuery.testAllDelineatedValuesCount(TestQuery.java:1033)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
>   at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>   at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
>   at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>   at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>   at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
>   at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
>   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>   at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>   at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
>   at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (NIFI-5633) EL - allDelineatedValues can throw ArrayIndexOutOfBoundsException

2018-09-25 Thread ASF subversion and git services (JIRA)


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

ASF subversion and git services commented on NIFI-5633:
---

Commit 5d3558a79d83defb4dd7484da3303cb04013cc6c in nifi's branch 
refs/heads/master from [~pvillard]
[ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=5d3558a ]

NIFI-5633 - allDelineatedValues can throw ArrayIndexOutOfBoundsException

This closes #3029.


> EL - allDelineatedValues can throw ArrayIndexOutOfBoundsException
> -
>
> Key: NIFI-5633
> URL: https://issues.apache.org/jira/browse/NIFI-5633
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Reporter: Pierre Villard
>Assignee: Pierre Villard
>Priority: Minor
>
> When running this unit test:
> {code:java}
> @Test
> public void testAllDelineatedValuesCount() {
> final Map attributes = new HashMap<>();
> final String query = "${allDelineatedValues('${test}', '/'):count()}";
> attributes.put("test", "/");
> assertEquals(ResultType.WHOLE_NUMBER, Query.getResultType(query));
> assertEquals("0", Query.evaluateExpressions(query, attributes, null));
> }
> {code}
> This will throw:
> {noformat}
> java.lang.ArrayIndexOutOfBoundsException: 0
>   at 
> org.apache.nifi.attribute.expression.language.evaluation.selection.DelineatedAttributeEvaluator.evaluate(DelineatedAttributeEvaluator.java:65)
>   at 
> org.apache.nifi.attribute.expression.language.evaluation.reduce.CountEvaluator.evaluate(CountEvaluator.java:38)
>   at 
> org.apache.nifi.attribute.expression.language.evaluation.selection.MappingEvaluator.evaluate(MappingEvaluator.java:38)
>   at 
> org.apache.nifi.attribute.expression.language.Query.evaluate(Query.java:363)
>   at 
> org.apache.nifi.attribute.expression.language.Query.evaluateExpression(Query.java:204)
>   at 
> org.apache.nifi.attribute.expression.language.CompiledExpression.evaluate(CompiledExpression.java:58)
>   at 
> org.apache.nifi.attribute.expression.language.StandardPreparedQuery.evaluateExpressions(StandardPreparedQuery.java:51)
>   at 
> org.apache.nifi.attribute.expression.language.StandardPreparedQuery.evaluateExpressions(StandardPreparedQuery.java:64)
>   at 
> org.apache.nifi.attribute.expression.language.Query.evaluateExpressions(Query.java:223)
>   at 
> org.apache.nifi.attribute.expression.language.TestQuery.testAllDelineatedValuesCount(TestQuery.java:1033)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
>   at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>   at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
>   at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>   at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>   at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
>   at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
>   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>   at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>   at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
>   at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (NIFI-5633) EL - allDelineatedValues can throw ArrayIndexOutOfBoundsException

2018-09-25 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot commented on NIFI-5633:
--

GitHub user pvillard31 opened a pull request:

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

NIFI-5633 - allDelineatedValues can throw ArrayIndexOutOfBoundsException

Thank you for submitting a contribution to Apache NiFi.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

### For all changes:
- [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
 in the commit message?

- [ ] Does your PR title start with NIFI- where  is the JIRA number 
you are trying to resolve? Pay particular attention to the hyphen "-" character.

- [ ] Has your PR been rebased against the latest commit within the target 
branch (typically master)?

- [ ] Is your initial contribution a single, squashed commit?

### For code changes:
- [ ] Have you ensured that the full suite of tests is executed via mvn 
-Pcontrib-check clean install at the root nifi folder?
- [ ] Have you written or updated unit tests to verify your changes?
- [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)? 
- [ ] If applicable, have you updated the LICENSE file, including the main 
LICENSE file under nifi-assembly?
- [ ] If applicable, have you updated the NOTICE file, including the main 
NOTICE file found under nifi-assembly?
- [ ] If adding new Properties, have you added .displayName in addition to 
.name (programmatic access) for each of the new properties?

### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in 
which it is rendered?

### Note:
Please ensure that once the PR is submitted, you check travis-ci for build 
issues and submit an update to your PR as soon as possible.


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

$ git pull https://github.com/pvillard31/nifi NIFI-5633

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

https://github.com/apache/nifi/pull/3029.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 #3029


commit b9cbc23114a0078c47384a84e91c0c0d9b24c1b2
Author: Pierre Villard 
Date:   2018-09-25T12:57:49Z

NIFI-5633 - allDelineatedValues can throw ArrayIndexOutOfBoundsException




> EL - allDelineatedValues can throw ArrayIndexOutOfBoundsException
> -
>
> Key: NIFI-5633
> URL: https://issues.apache.org/jira/browse/NIFI-5633
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Reporter: Pierre Villard
>Assignee: Pierre Villard
>Priority: Minor
>
> When running this unit test:
> {code:java}
> @Test
> public void testAllDelineatedValuesCount() {
> final Map attributes = new HashMap<>();
> final String query = "${allDelineatedValues('${test}', '/'):count()}";
> attributes.put("test", "/");
> assertEquals(ResultType.WHOLE_NUMBER, Query.getResultType(query));
> assertEquals("0", Query.evaluateExpressions(query, attributes, null));
> }
> {code}
> This will throw:
> {noformat}
> java.lang.ArrayIndexOutOfBoundsException: 0
>   at 
> org.apache.nifi.attribute.expression.language.evaluation.selection.DelineatedAttributeEvaluator.evaluate(DelineatedAttributeEvaluator.java:65)
>   at 
> org.apache.nifi.attribute.expression.language.evaluation.reduce.CountEvaluator.evaluate(CountEvaluator.java:38)
>   at 
> org.apache.nifi.attribute.expression.language.evaluation.selection.MappingEvaluator.evaluate(MappingEvaluator.java:38)
>   at 
> org.apache.nifi.attribute.expression.language.Query.evaluate(Query.java:363)
>   at 
> org.apache.nifi.attribute.expression.language.Query.evaluateExpression(Query.java:204)
>   at 
> org.apache.nifi.attribute.expression.language.CompiledExpression.evaluate(CompiledExpression.java:58)
>   at 
> org.apache.nifi.attribute.expression.language.StandardPreparedQuery.evaluateExpressions(StandardPreparedQuery.java:51)
>   at 
> org.apache.nifi.attribute.expression.language.StandardPreparedQuery.evaluateExpressions(StandardPreparedQuery.java:64)
>   at 
> org.apache.nifi.attribute.expression.language.Query.evaluateExpressions(Query.java:223)
>   at 
> org.apache.nifi.attribute.expression.language.TestQuery.testAllDelineatedValuesCount(TestQuery.java:1033)
>   at