You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2022/12/12 21:44:14 UTC

[nifi] branch main updated: NIFI-10958 Adjusted Script Engine handling to avoid exceptions

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

mattyb149 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 c11dff912a NIFI-10958 Adjusted Script Engine handling to avoid exceptions
c11dff912a is described below

commit c11dff912a288ae820beeb11c36a9b70b75c3e1e
Author: exceptionfactory <ex...@apache.org>
AuthorDate: Fri Dec 9 13:03:33 2022 -0600

    NIFI-10958 Adjusted Script Engine handling to avoid exceptions
    
    - Added empty check for list of discovered Script Engines to avoid exceptions for documentation generation on Java 17
    
    Signed-off-by: Matthew Burgess <ma...@apache.org>
    
    This closes #6774
---
 .../apache/nifi/script/ScriptingComponentHelper.java   | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/script/ScriptingComponentHelper.java b/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/script/ScriptingComponentHelper.java
index f11558403a..b7e5e1730e 100644
--- a/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/script/ScriptingComponentHelper.java
+++ b/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/script/ScriptingComponentHelper.java
@@ -178,15 +178,21 @@ public class ScriptingComponentHelper {
             engineAllowableValues = engineList;
             AllowableValue[] engines = engineList.toArray(new AllowableValue[0]);
 
-            SCRIPT_ENGINE = new PropertyDescriptor.Builder()
+            final PropertyDescriptor.Builder enginePropertyBuilder = new PropertyDescriptor.Builder()
                     .name("Script Engine")
                     .required(true)
-                    .description("The engine to execute scripts")
-                    .allowableValues(engines)
-                    .defaultValue(engines[0].getValue())
+                    .description("Language Engine for executing scripts")
                     .required(true)
-                    .expressionLanguageSupported(ExpressionLanguageScope.NONE)
-                    .build();
+                    .expressionLanguageSupported(ExpressionLanguageScope.NONE);
+
+            if (engineList.isEmpty()) {
+                enginePropertyBuilder.description("No Script Engines found");
+            } else {
+                enginePropertyBuilder.allowableValues(engines);
+                enginePropertyBuilder.defaultValue(engines[0].getValue());
+            }
+
+            SCRIPT_ENGINE = enginePropertyBuilder.build();
             descriptors.add(SCRIPT_ENGINE);
         }