Peter Turcsanyi created NIFI-9496:
-------------------------------------

             Summary: StandardParameterContext.parameters map may contain 
inconsistent key and value
                 Key: NIFI-9496
                 URL: https://issues.apache.org/jira/browse/NIFI-9496
             Project: Apache NiFi
          Issue Type: Improvement
            Reporter: Peter Turcsanyi


{{StandardParameterContext.parameters}} map stores {{ParameterDescriptor}} 
(key) to {{Parameter}} (value). The {{Parameter}} also has a reference to its 
{{{}ParameterDescriptor{}}}.
When the {{Parameter}} is updated (e.g. its description is changed), the 
{{Parameter}} will reference the new {{ParameterDescriptor}} but the map key 
will still be the old one (because {{ParameterDescriptor.equals()}} is based on 
the {{name}} field only).
This is an inconsistent data structure that may lead to bugs.
Using simple String key with {{ParameterDescriptor.name}} could be a solution.

To replicate the issue:
 - debug {{TestStandardParameterContext.testUpdateDescription()}} and stop at 
this line:
[https://github.com/apache/nifi/blob/7d8f99a1f41bb1806706c5db857f109c5d7b4e7f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/parameter/TestStandardParameterContext.java#L128]
 - check the key/value in {{context.parameters}}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to