[
https://issues.apache.org/jira/browse/NIFI-9311?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17435060#comment-17435060
]
ASF subversion and git services commented on NIFI-9311:
-------------------------------------------------------
Commit 3114bdb70121b444208a39959c6567a378a775e6 in nifi's branch
refs/heads/main from Mark Payne
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=3114bdb ]
NIFI-9311: When determining property values, be sure to fetch the property
descriptor from the component itself, rather than using the PropertyDescriptor
in the Map. This allows us to ensure that if the definition of the
PropertyDescriptor changes, the most up-to-date definition is picked up
Signed-off-by: Matthew Burgess <[email protected]>
This closes #5488
> Cannot remove scripted properties in InvokeScriptedProcessor
> ------------------------------------------------------------
>
> Key: NIFI-9311
> URL: https://issues.apache.org/jira/browse/NIFI-9311
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Reporter: Matt Burgess
> Assignee: Mark Payne
> Priority: Major
> Fix For: 1.15.0
>
> Time Spent: 40m
> Remaining Estimate: 0h
>
> If scripted properties are removed from a script in InvokeScriptedProcessor,
> they do not become unsupported properties when the script is reloaded. For
> example, load the following script:
> class GroovyProcessor implements Processor {
> def ComponentLog log
> def REL_SUCCESS = new Relationship.Builder().name("success")
> .description("FlowFiles that were successfully processed").build()
> @Override
> Set<Relationship> getRelationships()
> { return [REL_SUCCESS] as Set }
> def PASS = new PropertyDescriptor.Builder().name('Password')
> .required(true).sensitive(true).addValidator(Validator.VALID).build()
> def NS_USER = new PropertyDescriptor.Builder().name('NS Username')
> .required(true).sensitive(false).addValidator(Validator.VALID).build()
> @Override
> List<PropertyDescriptor> getPropertyDescriptors()
> { return [NS_USER, PASS] as List }
> @Override
> PropertyDescriptor getPropertyDescriptor(String name) {
> switch(name)
> { case 'Password': return PASS case 'NS Username': return NS_USER default:
> return null }
> }
> @Override
> void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory)
> throws ProcessException {
> try
> { def session = sessionFactory.createSession() def flowFile = session.get()
> if(!flowFile) return def pass = context.getProperty(PASS).getValue() // do
> something with pass session.transfer(flowFile,REL_SUCCESS) session.commit() }
> catch (e)
> { throw new ProcessException(e) }
> }
> @Override
> void initialize(ProcessorInitializationContext context)
> { log = context.getLogger() }
> @Override
> Collection<ValidationResult> validate(ValidationContext context)
> { return null }
> @Override
> void onPropertyModified(PropertyDescriptor descriptor, String oldValue,
> String newValue) \{ }
> @Override
> String getIdentifier() \{ return null }
> }
> processor = new GroovyProcessor()
>
> Then go back into the configuration dialog and remove one of the properties,
> then click Apply. The removed property should now be an unsupported property
> (not a dynamic property).
--
This message was sent by Atlassian Jira
(v8.3.4#803005)