Details

    • Flags:
      Patch

      Description

      InvokeScriptedProcessor pass his ValidationContext to the inner script, validate call

      InvokeScriptedProcessor Line 465 : final Collection<ValidationResult> instanceResults = instance.validate(context);

      The problem is that the invokedscript pass the ScriptFile PropertyDescriptor that is validated, if the script derived from the AbstractConfigurableComponent, (because the AbstractConfigurableComponent validate all the context properties).

      The context should be refined to remove the InvokeScriptedProcessor Properties.

        Activity

        Hide
        frett27 Patrice Freydiere added a comment -

        When Script extends AbstractProcessor this exception is raised :

        [main] ERROR org.apache.nifi.processors.script.BaseScriptTest$AccessibleInvokeScriptedProcessor - [AccessibleInvokeScriptedProcessor[id=3d530126-78e2-4eab-94d1-9e81c1896c25]] Unable to validate the script Processor: java.lang.reflect.UndeclaredThrowableException
        java.lang.reflect.UndeclaredThrowableException
        at com.sun.proxy.$Proxy19.validate(Unknown Source)
        at org.apache.nifi.processors.script.InvokeScriptedProcessor.customValidate(InvokeScriptedProcessor.java:475)
        at org.apache.nifi.components.AbstractConfigurableComponent.validate(AbstractConfigurableComponent.java:126)
        at org.apache.nifi.util.MockProcessContext.validate(MockProcessContext.java:235)
        at org.apache.nifi.util.MockProcessContext.assertValid(MockProcessContext.java:252)
        at org.apache.nifi.util.StandardProcessorTestRunner.assertValid(StandardProcessorTestRunner.java:342)
        at org.apache.nifi.processors.script.TestInvokeGroovy.testAbstractProcessorImplementationWithBodyScriptFile(TestInvokeGroovy.java:190)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
        Caused by: javax.script.ScriptException: java.lang.NullPointerException
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeImpl(GroovyScriptEngineImpl.java:405)
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.access$100(GroovyScriptEngineImpl.java:98)
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl$3.invoke(GroovyScriptEngineImpl.java:446)
        ... 32 more
        Caused by: java.lang.NullPointerException
        at java.io.File.<init>(Unknown Source)
        at org.apache.nifi.processor.util.StandardValidators$FileExistsValidator.validate(StandardValidators.java:784)
        at org.apache.nifi.components.PropertyDescriptor.validate(PropertyDescriptor.java:200)
        at org.apache.nifi.components.AbstractConfigurableComponent.validate(AbstractConfigurableComponent.java:116)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1210)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
        at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:919)
        at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:902)
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeImpl(GroovyScriptEngineImpl.java:398)
        ... 34 more

        Show
        frett27 Patrice Freydiere added a comment - When Script extends AbstractProcessor this exception is raised : [main] ERROR org.apache.nifi.processors.script.BaseScriptTest$AccessibleInvokeScriptedProcessor - [AccessibleInvokeScriptedProcessor [id=3d530126-78e2-4eab-94d1-9e81c1896c25] ] Unable to validate the script Processor: java.lang.reflect.UndeclaredThrowableException java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy19.validate(Unknown Source) at org.apache.nifi.processors.script.InvokeScriptedProcessor.customValidate(InvokeScriptedProcessor.java:475) at org.apache.nifi.components.AbstractConfigurableComponent.validate(AbstractConfigurableComponent.java:126) at org.apache.nifi.util.MockProcessContext.validate(MockProcessContext.java:235) at org.apache.nifi.util.MockProcessContext.assertValid(MockProcessContext.java:252) at org.apache.nifi.util.StandardProcessorTestRunner.assertValid(StandardProcessorTestRunner.java:342) at org.apache.nifi.processors.script.TestInvokeGroovy.testAbstractProcessorImplementationWithBodyScriptFile(TestInvokeGroovy.java:190) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: javax.script.ScriptException: java.lang.NullPointerException at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeImpl(GroovyScriptEngineImpl.java:405) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.access$100(GroovyScriptEngineImpl.java:98) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl$3.invoke(GroovyScriptEngineImpl.java:446) ... 32 more Caused by: java.lang.NullPointerException at java.io.File.<init>(Unknown Source) at org.apache.nifi.processor.util.StandardValidators$FileExistsValidator.validate(StandardValidators.java:784) at org.apache.nifi.components.PropertyDescriptor.validate(PropertyDescriptor.java:200) at org.apache.nifi.components.AbstractConfigurableComponent.validate(AbstractConfigurableComponent.java:116) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1210) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019) at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:919) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:902) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeImpl(GroovyScriptEngineImpl.java:398) ... 34 more
        Hide
        frett27 Patrice Freydiere added a comment -

        using extends AbstractProcessor in a script lead to an exception, because the scripted class receive the invokescriptedprocessor properties,

        this patch fix this, and now permit to derive from helper base class opening the use to record based derivations, and making processing thought this.

        Show
        frett27 Patrice Freydiere added a comment - using extends AbstractProcessor in a script lead to an exception, because the scripted class receive the invokescriptedprocessor properties, this patch fix this, and now permit to derive from helper base class opening the use to record based derivations, and making processing thought this.
        Hide
        frett27 Patrice Freydiere added a comment -

        The patch for 4367

        Show
        frett27 Patrice Freydiere added a comment - The patch for 4367

          People

          • Assignee:
            Unassigned
            Reporter:
            frett27 Patrice Freydiere
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development