mirror of
https://github.com/apache/struts.git
synced 2026-08-11 09:36:57 +00:00
WW-4055 Includes all jars by default
This commit is contained in:
+24
-31
@@ -93,7 +93,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
|
|||||||
private String[] actionPackages;
|
private String[] actionPackages;
|
||||||
private String[] excludePackages;
|
private String[] excludePackages;
|
||||||
private String[] packageLocators;
|
private String[] packageLocators;
|
||||||
private String[] includeJars;
|
private String[] includeJars = new String[] { ".*?\\.jar(!/|/)?" };
|
||||||
private String packageLocatorsBasePackage;
|
private String packageLocatorsBasePackage;
|
||||||
private boolean disableActionScanning = false;
|
private boolean disableActionScanning = false;
|
||||||
private boolean disablePackageLocatorsScanning = false;
|
private boolean disablePackageLocatorsScanning = false;
|
||||||
@@ -458,42 +458,35 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
|
|||||||
urlSet = urlSet.excludePaths(System.getProperty("sun.boot.class.path", ""));
|
urlSet = urlSet.excludePaths(System.getProperty("sun.boot.class.path", ""));
|
||||||
urlSet = urlSet.exclude(".*/JavaVM.framework/.*");
|
urlSet = urlSet.exclude(".*/JavaVM.framework/.*");
|
||||||
|
|
||||||
if (includeJars == null) {
|
List<URL> rawIncludedUrls = urlSet.getUrls();
|
||||||
urlSet = urlSet.exclude(".*?\\.jar(!/|/)?");
|
Set<URL> includeUrls = new HashSet<URL>();
|
||||||
} else {
|
boolean[] patternUsed = new boolean[includeJars.length];
|
||||||
//jar urls regexes were specified
|
|
||||||
List<URL> rawIncludedUrls = urlSet.getUrls();
|
|
||||||
Set<URL> includeUrls = new HashSet<URL>();
|
|
||||||
boolean[] patternUsed = new boolean[includeJars.length];
|
|
||||||
|
|
||||||
for (URL url : rawIncludedUrls) {
|
for (URL url : rawIncludedUrls) {
|
||||||
if (fileProtocols.contains(url.getProtocol())) {
|
if (fileProtocols.contains(url.getProtocol())) {
|
||||||
//it is a jar file, make sure it macthes at least a url regex
|
//it is a jar file, make sure it macthes at least a url regex
|
||||||
for (int i = 0; i < includeJars.length; i++) {
|
for (int i = 0; i < includeJars.length; i++) {
|
||||||
String includeJar = includeJars[i];
|
String includeJar = includeJars[i];
|
||||||
if (Pattern.matches(includeJar, url.toExternalForm())) {
|
if (Pattern.matches(includeJar, url.toExternalForm())) {
|
||||||
includeUrls.add(url);
|
includeUrls.add(url);
|
||||||
patternUsed[i] = true;
|
patternUsed[i] = true;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//it is not a jar
|
|
||||||
includeUrls.add(url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (LOG.isWarnEnabled()) {
|
|
||||||
for (int i = 0; i < patternUsed.length; i++) {
|
|
||||||
if (!patternUsed[i]) {
|
|
||||||
LOG.warn("The includeJars pattern [#0] did not match any jars in the classpath", includeJars[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
//it is not a jar
|
||||||
|
includeUrls.add(url);
|
||||||
}
|
}
|
||||||
return new UrlSet(includeUrls);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return urlSet;
|
if (LOG.isWarnEnabled()) {
|
||||||
|
for (int i = 0; i < patternUsed.length; i++) {
|
||||||
|
if (!patternUsed[i]) {
|
||||||
|
LOG.warn("The includeJars pattern [#0] did not match any jars in the classpath", includeJars[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new UrlSet(includeUrls);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user