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
This closes
@@ -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);
}
