[jrubyscripting] Filter out empty require options (#12386)
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
This commit is contained in:
parent
6c25e8b528
commit
166e4ec1b6
|
@ -198,16 +198,16 @@ public class JRubyScriptEngineConfiguration {
|
|||
return;
|
||||
}
|
||||
|
||||
String[] scripts = requireConfigElement.getValue().get().split(",");
|
||||
for (String script : scripts) {
|
||||
final String requireStatement = String.format("require '%s'", script.trim());
|
||||
Stream.of(requireConfigElement.getValue().get().split(",")).map(s -> s.trim()).filter(s -> !s.isEmpty())
|
||||
.forEach(script -> {
|
||||
final String requireStatement = String.format("require '%s'", script);
|
||||
try {
|
||||
logger.trace("Injecting require statement: {}", requireStatement);
|
||||
engine.eval(requireStatement);
|
||||
} catch (ScriptException e) {
|
||||
logger.warn("Error evaluating statement {}: {}", requireStatement, e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue