This is an automated email from the ASF dual-hosted git repository.

markap14 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 4f11e36  NIFI-7635: StandardConfigurationContext.getProperty() gets 
the property descriptor and its default value from the component itself
4f11e36 is described below

commit 4f11e3626093d3090f97c0efc5e229d83b6006e4
Author: Peter Gyori <[email protected]>
AuthorDate: Tue Jul 14 10:04:04 2020 +0200

    NIFI-7635: StandardConfigurationContext.getProperty() gets the property 
descriptor and its default value from the component itself
    
    This closes #4408.
    
    Signed-off-by: Mark Payne <[email protected]>
---
 .../controller/service/StandardConfigurationContext.java   | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardConfigurationContext.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardConfigurationContext.java
index 0a6f80b..476ea0e 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardConfigurationContext.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/service/StandardConfigurationContext.java
@@ -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);
     }

Reply via email to