Skip to content
Merged
Changes from 2 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 @@
*/
/* private final */ static int CHECK_UPDATE_ATTEMPTS;

/**
* Class name prefixes to skip in the class loading
*/
private static final String[] CLASS_PREFIXES_TO_SKIP = new String[] {
"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 @@

@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)) {

Check warning on line 2421 in core/src/main/java/hudson/PluginManager.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 2421 is only partially covered, one branch is missing
throw new ClassNotFoundException("ignoring " + name);
}
}
return loaded.computeIfAbsent(name, this::computeValue).orElseThrow(() -> new ClassNotFoundException(name));
}
Expand Down
Loading