mirror of https://github.com/apache/nifi.git
NIFI-9345: Resolving NPE in ProcessorEntityMerger (#5491)
NIFI-9345: Resolving NPE in ProcessorEntityMerger, Streamlining forEach calls
This commit is contained in:
parent
74151eab1f
commit
28cd5d1300
|
@ -90,7 +90,7 @@ public class ControllerServiceEntityMerger implements ComponentEntityMerger<Cont
|
|||
// aggregate the property descriptors
|
||||
final Map<String, PropertyDescriptorDTO> descriptors = nodeControllerService.getDescriptors();
|
||||
if (descriptors != null) {
|
||||
descriptors.values().stream().forEach(propertyDescriptor -> {
|
||||
descriptors.values().forEach(propertyDescriptor -> {
|
||||
propertyDescriptorMap.computeIfAbsent(propertyDescriptor.getName(), nodeIdToPropertyDescriptor -> new HashMap<>()).put(nodeId, propertyDescriptor);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -86,9 +86,11 @@ public class ProcessorEntityMerger implements ComponentEntityMerger<ProcessorEnt
|
|||
ErrorMerger.mergeErrors(validationErrorMap, nodeId, nodeProcessor.getValidationErrors());
|
||||
|
||||
// aggregate the property descriptors
|
||||
nodeProcessor.getConfig().getDescriptors().values().stream().forEach(propertyDescriptor -> {
|
||||
propertyDescriptorMap.computeIfAbsent(propertyDescriptor.getName(), nodeIdToPropertyDescriptor -> new HashMap<>()).put(nodeId, propertyDescriptor);
|
||||
});
|
||||
if (nodeProcessor.getConfig().getDescriptors() != null) {
|
||||
nodeProcessor.getConfig().getDescriptors().values().forEach(propertyDescriptor -> {
|
||||
propertyDescriptorMap.computeIfAbsent(propertyDescriptor.getName(), nodeIdToPropertyDescriptor -> new HashMap<>()).put(nodeId, propertyDescriptor);
|
||||
});
|
||||
}
|
||||
|
||||
// if any node does not support multiple versions (null or false), make it unavailable
|
||||
if (clientDto.getMultipleVersionsAvailable() == null || !Boolean.TRUE.equals(nodeProcessor.getMultipleVersionsAvailable())) {
|
||||
|
|
|
@ -73,9 +73,11 @@ public class ReportingTaskEntityMerger implements ComponentEntityMerger<Reportin
|
|||
ErrorMerger.mergeErrors(validationErrorMap, nodeId, nodeReportingTask.getValidationErrors());
|
||||
|
||||
// aggregate the property descriptors
|
||||
nodeReportingTask.getDescriptors().values().stream().forEach(propertyDescriptor -> {
|
||||
propertyDescriptorMap.computeIfAbsent(propertyDescriptor.getName(), nodeIdToPropertyDescriptor -> new HashMap<>()).put(nodeId, propertyDescriptor);
|
||||
});
|
||||
if (nodeReportingTask.getDescriptors() != null) {
|
||||
nodeReportingTask.getDescriptors().values().forEach(propertyDescriptor -> {
|
||||
propertyDescriptorMap.computeIfAbsent(propertyDescriptor.getName(), nodeIdToPropertyDescriptor -> new HashMap<>()).put(nodeId, propertyDescriptor);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue