NIFI-6380: Fixed NPE that is thrown when clustered and using parameters from Controller Services

This closes #3635
This commit is contained in:
Mark Payne 2019-08-05 14:17:16 -04:00 committed by Matt Gilman
parent 52645e8aa7
commit 164e0c4186
No known key found for this signature in database
GPG Key ID: DF61EC19432AEE37
1 changed files with 11 additions and 1 deletions

View File

@ -142,7 +142,7 @@ public class ParameterContextMerger {
final AffectedComponentDTO mergedComponent = merged.getComponent();
final AffectedComponentDTO additionalComponent = additional.getComponent();
mergedComponent.setActiveThreadCount(mergedComponent.getActiveThreadCount() + additionalComponent.getActiveThreadCount());
mergedComponent.setActiveThreadCount(add(mergedComponent.getActiveThreadCount(), additionalComponent.getActiveThreadCount()));
if (mergedComponent.getValidationErrors() == null) {
mergedComponent.setValidationErrors(new ArrayList<>());
@ -152,4 +152,14 @@ public class ParameterContextMerger {
mergedComponent.getValidationErrors().addAll(additionalComponent.getValidationErrors());
}
}
private static Integer add(final Integer a, final Integer b) {
if (a == null) {
return b;
}
if (b == null) {
return a;
}
return a + b;
}
}