Skip to content

Commit 24304ef

Browse files
committed
Fix Sonar smell around new GroovyClassLoader()
1 parent 745524f commit 24304ef

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

spring-integration-groovy/src/main/java/org/springframework/integration/groovy/GroovyScriptExecutingMessageProcessor.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,18 @@ public void afterPropertiesSet() {
150150
((ConfigurableListableBeanFactory) beanFactory).ignoreDependencyType(MetaClass.class);
151151
}
152152

153-
CompilerConfiguration compilerConfig = this.compilerConfiguration;
154-
if (compilerConfig == null && this.compileStatic) {
153+
CompilerConfiguration compilerConfig;
154+
if (this.compilerConfiguration == null && this.compileStatic) {
155155
compilerConfig = new CompilerConfiguration();
156156
compilerConfig.addCompilationCustomizers(new ASTTransformationCustomizer(CompileStatic.class));
157157
}
158+
else {
159+
compilerConfig = this.compilerConfiguration;
160+
}
158161

159-
this.groovyClassLoader = new GroovyClassLoader(getBeanClassLoader(), compilerConfig);
162+
this.groovyClassLoader =
163+
AccessController.doPrivileged((PrivilegedAction<GroovyClassLoader>)
164+
() -> new GroovyClassLoader(getBeanClassLoader(), compilerConfig));
160165
}
161166

162167
@Override

0 commit comments

Comments
 (0)