NIFI-7635: StandardConfigurationContext.getProperty() gets the property descriptor and its default value from the component itself

This closes #4408.

Signed-off-by: Mark Payne <markap14@hotmail.com>
This commit is contained in:
Peter Gyori 2020-07-14 10:04:04 +02:00 committed by Mark Payne
parent b1e77019ac
commit 4f11e36260
1 changed files with 4 additions and 8 deletions

View File

@ -74,15 +74,11 @@ public class StandardConfigurationContext implements ConfigurationContext {
@Override
public PropertyValue getProperty(final PropertyDescriptor property) {
final String configuredValue = component.getEffectivePropertyValue(property);
final String resolvedValue = (configuredValue == null) ? property.getDefaultValue() : configuredValue;
if (resolvedValue == null) {
// We need to get the 'canonical representation' of the property descriptor from the component itself,
// since the supplied PropertyDescriptor may have been built using only the name, and without the proper
// default value.
final PropertyDescriptor resolvedDescriptor = component.getPropertyDescriptor(property.getName());
return new StandardPropertyValue(resolvedDescriptor.getDefaultValue(), serviceLookup, component.getParameterLookup(), preparedQueries.get(property), variableRegistry);
}
// We need to get the 'canonical representation' of the property descriptor from the component itself,
// since the supplied PropertyDescriptor may not have the proper default value.
final PropertyDescriptor resolvedDescriptor = component.getPropertyDescriptor(property.getName());
final String resolvedValue = (configuredValue == null) ? resolvedDescriptor.getDefaultValue() : configuredValue;
return new StandardPropertyValue(resolvedValue, serviceLookup, component.getParameterLookup(), preparedQueries.get(property), variableRegistry);
}