You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2017/03/23 13:50:26 UTC
struts git commit: WW-4769 Makes excluded classes & packages
definitions immutable
Repository: struts
Updated Branches:
refs/heads/master d053df492 -> 748da3f8c
WW-4769 Makes excluded classes & packages definitions immutable
Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/748da3f8
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/748da3f8
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/748da3f8
Branch: refs/heads/master
Commit: 748da3f8ce6b9f3953bc418745c35a534e5b98ca
Parents: d053df4
Author: Lukasz Lenart <lu...@apache.org>
Authored: Thu Mar 23 14:50:05 2017 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Thu Mar 23 14:50:05 2017 +0100
----------------------------------------------------------------------
.../com/opensymphony/xwork2/ognl/OgnlUtil.java | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/struts/blob/748da3f8/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
index 86e9c53..74da771 100644
--- a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
+++ b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java
@@ -90,27 +90,35 @@ public class OgnlUtil {
@Inject(value = XWorkConstants.OGNL_EXCLUDED_CLASSES, required = false)
public void setExcludedClasses(String commaDelimitedClasses) {
- Set<String> classes = TextParseUtil.commaDelimitedStringToSet(commaDelimitedClasses);
- for (String className : classes) {
+ Set<String> classNames = TextParseUtil.commaDelimitedStringToSet(commaDelimitedClasses);
+ Set<Class<?>> classes = new HashSet<>();
+
+ for (String className : classNames) {
try {
- excludedClasses.add(Class.forName(className));
+ classes.add(Class.forName(className));
} catch (ClassNotFoundException e) {
throw new ConfigurationException("Cannot load excluded class: " + className, e);
}
}
+
+ excludedClasses = Collections.unmodifiableSet(classes);
}
@Inject(value = XWorkConstants.OGNL_EXCLUDED_PACKAGE_NAME_PATTERNS, required = false)
public void setExcludedPackageNamePatterns(String commaDelimitedPackagePatterns) {
Set<String> packagePatterns = TextParseUtil.commaDelimitedStringToSet(commaDelimitedPackagePatterns);
+ Set<Pattern> packageNamePatterns = new HashSet<>();
+
for (String pattern : packagePatterns) {
- excludedPackageNamePatterns.add(Pattern.compile(pattern));
+ packageNamePatterns.add(Pattern.compile(pattern));
}
+
+ excludedPackageNamePatterns = Collections.unmodifiableSet(packageNamePatterns);
}
@Inject(value = XWorkConstants.OGNL_EXCLUDED_PACKAGE_NAMES, required = false)
public void setExcludedPackageNames(String commaDelimitedPackageNames) {
- excludedPackageNames = TextParseUtil.commaDelimitedStringToSet(commaDelimitedPackageNames);
+ excludedPackageNames = Collections.unmodifiableSet(TextParseUtil.commaDelimitedStringToSet(commaDelimitedPackageNames));
}
public Set<Class<?>> getExcludedClasses() {