mirror of https://github.com/apache/nifi.git
NIFI-6380: Fixed NPE that is thrown when clustered and using parameters from Controller Services
This closes #3635
This commit is contained in:
parent
52645e8aa7
commit
164e0c4186
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue