Merge branch '3.1.x'

Closes gh-38405
This commit is contained in:
Phillip Webb
2023-11-20 16:27:46 -08:00
13 changed files with 123 additions and 32 deletions

View File

@@ -20,6 +20,7 @@ import java.io.File;
import java.lang.management.ManagementFactory;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
@@ -318,7 +319,10 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
private boolean isExcluded(URL url) {
if ("file".equals(url.getProtocol())) {
try {
String name = new File(url.toURI()).getName();
URI uri = url.toURI();
File file = new File(uri);
String name = (!uri.toString().endsWith("/")) ? file.getName()
: file.getParentFile().getParentFile().getName();
for (String exclusion : this.exclusions) {
if (this.matcher.match(exclusion, name)) {
return true;