Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions core/src/main/java/hudson/PluginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,14 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
*/
/* private final */ static int CHECK_UPDATE_ATTEMPTS;

/**
* Class name prefixes to skip in the class loading
*/
private static final String[] CLASS_PREFIXES_TO_SKIP = {
"SimpleTemplateScript", // cf. groovy.text.SimpleTemplateEngine
"groovy.tmp.templates.GStringTemplateScript", // Leaks on classLoader in some cases, see JENKINS-75879
};

static {
try {
// Secure initialization
Expand Down Expand Up @@ -2409,8 +2417,10 @@ public UberClassLoader(List<PluginWrapper> activePlugins) {

@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
if (name.startsWith("SimpleTemplateScript")) { // cf. groovy.text.SimpleTemplateEngine
throw new ClassNotFoundException("ignoring " + name);
for (String namePrefixToSkip : CLASS_PREFIXES_TO_SKIP) {
if (name.startsWith(namePrefixToSkip)) {
throw new ClassNotFoundException("ignoring " + name);
}
}
return loaded.computeIfAbsent(name, this::computeValue).orElseThrow(() -> new ClassNotFoundException(name));
}
Expand Down