Avoid NullPointerException if optional Groovy jar is removed
This commit is contained in:
parent
c610524392
commit
cc461a837f
|
@ -211,15 +211,17 @@ public class ScriptService extends AbstractComponent {
|
|||
@Override
|
||||
public void onRefreshSettings(Settings settings) {
|
||||
GroovyScriptEngineService engine = (GroovyScriptEngineService) ScriptService.this.scriptEngines.get("groovy");
|
||||
String[] patches = settings.getAsArray(GroovyScriptEngineService.GROOVY_SCRIPT_BLACKLIST_PATCH, Strings.EMPTY_ARRAY);
|
||||
if (Arrays.equals(patches, engine.blacklistAdditions()) == false) {
|
||||
logger.info("updating [{}] from {} to {}", GroovyScriptEngineService.GROOVY_SCRIPT_BLACKLIST_PATCH,
|
||||
engine.blacklistAdditions(), patches);
|
||||
engine.blacklistAdditions(patches);
|
||||
engine.reloadConfig();
|
||||
// Because the GroovyScriptEngineService knows nothing about the
|
||||
// cache, we need to clear it here if the setting changes
|
||||
ScriptService.this.clearCache();
|
||||
if (engine != null) {
|
||||
String[] patches = settings.getAsArray(GroovyScriptEngineService.GROOVY_SCRIPT_BLACKLIST_PATCH, Strings.EMPTY_ARRAY);
|
||||
if (Arrays.equals(patches, engine.blacklistAdditions()) == false) {
|
||||
logger.info("updating [{}] from {} to {}", GroovyScriptEngineService.GROOVY_SCRIPT_BLACKLIST_PATCH,
|
||||
engine.blacklistAdditions(), patches);
|
||||
engine.blacklistAdditions(patches);
|
||||
engine.reloadConfig();
|
||||
// Because the GroovyScriptEngineService knows nothing about the
|
||||
// cache, we need to clear it here if the setting changes
|
||||
ScriptService.this.clearCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue