Don't propagate null CL to GroovyScriptFactory

https://build.spring.io/browse/INT-MASTER-1505/

* Fix Sonar smells in the `AbstractScriptParser`
This commit is contained in:
Artem Bilan
2019-04-20 12:14:00 -04:00
parent be86db5509
commit 455cc9b4be
2 changed files with 10 additions and 9 deletions

View File

@@ -125,7 +125,10 @@ public class GroovyCommandMessageProcessor extends AbstractScriptExecutingMessag
customizerDecorator.setVariables(variables);
}
GroovyScriptFactory factory = new GroovyScriptFactory(getClass().getSimpleName(), customizerDecorator);
factory.setBeanClassLoader(getBeanClassLoader());
ClassLoader beanClassLoader = getBeanClassLoader();
if (beanClassLoader != null) {
factory.setBeanClassLoader(beanClassLoader);
}
factory.setBeanFactory(getBeanFactory());
try {
Object result = factory.getScriptedObject(scriptSource);