Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-9311

Cannot remove scripted properties in InvokeScriptedProcessor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.15.0
    • Extensions
    • None

    Description

      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).

      Attachments

        Issue Links

          Activity

            People

              markap14 Mark Payne
              mattyb149 Matt Burgess
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m