Avoid NullPointerException if optional Groovy jar is removed
This commit is contained in:
parent
c610524392
commit
cc461a837f
|
@ -211,6 +211,7 @@ public class ScriptService extends AbstractComponent {
|
||||||
@Override
|
@Override
|
||||||
public void onRefreshSettings(Settings settings) {
|
public void onRefreshSettings(Settings settings) {
|
||||||
GroovyScriptEngineService engine = (GroovyScriptEngineService) ScriptService.this.scriptEngines.get("groovy");
|
GroovyScriptEngineService engine = (GroovyScriptEngineService) ScriptService.this.scriptEngines.get("groovy");
|
||||||
|
if (engine != null) {
|
||||||
String[] patches = settings.getAsArray(GroovyScriptEngineService.GROOVY_SCRIPT_BLACKLIST_PATCH, Strings.EMPTY_ARRAY);
|
String[] patches = settings.getAsArray(GroovyScriptEngineService.GROOVY_SCRIPT_BLACKLIST_PATCH, Strings.EMPTY_ARRAY);
|
||||||
if (Arrays.equals(patches, engine.blacklistAdditions()) == false) {
|
if (Arrays.equals(patches, engine.blacklistAdditions()) == false) {
|
||||||
logger.info("updating [{}] from {} to {}", GroovyScriptEngineService.GROOVY_SCRIPT_BLACKLIST_PATCH,
|
logger.info("updating [{}] from {} to {}", GroovyScriptEngineService.GROOVY_SCRIPT_BLACKLIST_PATCH,
|
||||||
|
@ -223,6 +224,7 @@ public class ScriptService extends AbstractComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ScriptService(Settings settings, Environment env, Set<ScriptEngineService> scriptEngines,
|
public ScriptService(Settings settings, Environment env, Set<ScriptEngineService> scriptEngines,
|
||||||
|
|
Loading…
Reference in New Issue