[GitHub] nifi pull request #2734: NIFI-5230: Fixed NPE in InvokeScriptedProcessor on ...

2018-05-23 Thread bdesert
Github user bdesert commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2734#discussion_r190286397
  
--- Diff: 
nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/InvokeScriptedProcessor.java
 ---
@@ -237,7 +237,7 @@ public void setup() {
 @Override
 public void onPropertyModified(final PropertyDescriptor descriptor, 
final String oldValue, final String newValue) {
 
--- End diff --

@ottobackwards , regarding Set vs List. Validation Result supposed to be 
Collection, so technically - any of them can be used. But consistency should 
come with Set, as if you check super class AbstractConfigurableComponent, its 
customValidate returns:
return Collections.emptySet();
So, I would say, we need to refactor ArrayList into Set, but then there 
will be more potential regression impact. I'd recommend to keep it as is for 
this PR/Jira, and have another ticket opened on cosmetic improvement to change 
ArrayList to to some Set implementation during initialization. I hope it makes 
sense.


---


[GitHub] nifi pull request #2734: NIFI-5230: Fixed NPE in InvokeScriptedProcessor on ...

2018-05-23 Thread ottobackwards
Github user ottobackwards commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2734#discussion_r190284675
  
--- Diff: 
nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/InvokeScriptedProcessor.java
 ---
@@ -237,7 +237,7 @@ public void setup() {
 @Override
 public void onPropertyModified(final PropertyDescriptor descriptor, 
final String oldValue, final String newValue) {
 
--- End diff --

Ok, that makes sense.  Thanks for the explanation.


---


[GitHub] nifi pull request #2734: NIFI-5230: Fixed NPE in InvokeScriptedProcessor on ...

2018-05-23 Thread bdesert
Github user bdesert commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2734#discussion_r190283975
  
--- Diff: 
nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/InvokeScriptedProcessor.java
 ---
@@ -237,7 +237,7 @@ public void setup() {
 @Override
 public void onPropertyModified(final PropertyDescriptor descriptor, 
final String oldValue, final String newValue) {
 
--- End diff --

@ottobackwards , when a processor is invalid (customValidate returned 
validation errors), we keep all the validationResults. Method 'customValidate' 
just check if there are already errors - no need to validate again, just return 
whatever is stored.
When any property is getting modified - these validation results may not be 
accurate anymore, so we have to reset them. Once reset (onPropertyModified), 
next call to customValidate will run full validation and set new errors if 
found. So at any point we don't drop validation results for no reason. Am I 
missing anything?


---


[GitHub] nifi pull request #2734: NIFI-5230: Fixed NPE in InvokeScriptedProcessor on ...

2018-05-23 Thread ottobackwards
Github user ottobackwards commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2734#discussion_r190267071
  
--- Diff: 
nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/InvokeScriptedProcessor.java
 ---
@@ -237,7 +237,7 @@ public void setup() {
 @Override
 public void onPropertyModified(final PropertyDescriptor descriptor, 
final String oldValue, final String newValue) {
 
--- End diff --

Also, I don't understand customValidate.   The validationResults are used 
to 'seed' the currentValidationResults, but if empty, any new validation 
results are not set back to validationResults.  Is that right?


---


[GitHub] nifi pull request #2734: NIFI-5230: Fixed NPE in InvokeScriptedProcessor on ...

2018-05-23 Thread ottobackwards
Github user ottobackwards commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2734#discussion_r190263349
  
--- Diff: 
nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/InvokeScriptedProcessor.java
 ---
@@ -237,7 +237,7 @@ public void setup() {
 @Override
 public void onPropertyModified(final PropertyDescriptor descriptor, 
final String oldValue, final String newValue) {
 
--- End diff --

Why are we using HashSet here, when we initialize to ArrayList initially?  
Shouldn't they be the same and consistent?


---


[GitHub] nifi pull request #2734: NIFI-5230: Fixed NPE in InvokeScriptedProcessor on ...

2018-05-23 Thread asfgit
Github user asfgit closed the pull request at:

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


---


[GitHub] nifi pull request #2734: NIFI-5230: Fixed NPE in InvokeScriptedProcessor on ...

2018-05-23 Thread mattyb149
GitHub user mattyb149 opened a pull request:

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

NIFI-5230: Fixed NPE in InvokeScriptedProcessor on customValidate

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:
- [x] Is there a JIRA ticket associated with this PR? Is it referenced 
 in the commit message?

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

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

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

### For code changes:
- [x] Have you ensured that the full suite of tests is executed via mvn 
-Pcontrib-check clean install at the root nifi folder?
- [x] 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/mattyb149/nifi NIFI-5230

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

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


commit 5d2ad915b11df17d0acea270f128667141387d24
Author: Matthew Burgess 
Date:   2018-05-23T13:52:33Z

NIFI-5230: Fixed NPE in InvokeScriptedProcessor on customValidate




---