[struts] 02/04: WW-5336 Deprecate OgnlTool
This is an automated email from the ASF dual-hosted git repository. kusal pushed a commit to branch WW-5336-deprecate-ognltool in repository https://gitbox.apache.org/repos/asf/struts.git commit 028ca92ac474c7ad923057fdd3c57faf4a8cf531 Author: Kusal Kithul-Godage AuthorDate: Mon Aug 21 19:06:01 2023 +1000 WW-5336 Deprecate OgnlTool --- .../main/java/org/apache/struts2/util/StrutsUtil.java| 16 +++- .../java/org/apache/struts2/views/jsp/ui/OgnlTool.java | 10 +++--- core/src/main/resources/struts-beans.xml | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/apache/struts2/util/StrutsUtil.java b/core/src/main/java/org/apache/struts2/util/StrutsUtil.java index 36cfabcc9..f9fc43bf3 100644 --- a/core/src/main/java/org/apache/struts2/util/StrutsUtil.java +++ b/core/src/main/java/org/apache/struts2/util/StrutsUtil.java @@ -52,6 +52,7 @@ public class StrutsUtil { protected HttpServletResponse response; protected Map classes = new Hashtable<>(); protected OgnlTool ognl; +protected OgnlUtil ognl; protected ValueStack stack; private UrlHelper urlHelper; @@ -61,7 +62,7 @@ public class StrutsUtil { this.stack = stack; this.request = request; this.response = response; -this.ognl = stack.getActionContext().getContainer().getInstance(OgnlTool.class); +this.ognl = stack.getActionContext().getContainer().getInstance(OgnlUtil.class); this.urlHelper = stack.getActionContext().getContainer().getInstance(UrlHelper.class); this.objectFactory = stack.getActionContext().getContainer().getInstance(ObjectFactory.class); } @@ -124,6 +125,17 @@ public class StrutsUtil { return stack.findValue(expression, Class.forName(className)); } +public Object findValue(String expr, Object context) { +try { +return ognl.getValue(expr, ActionContext.getContext().getContextMap(), context); +} catch (OgnlException e) { +if (e.getReason() instanceof SecurityException) { +LOG.error(format("Could not evaluate this expression due to security constraints: [{0}]", expr), e); +} +return null; +} +} + public String getText(String text) { return (String) stack.findValue("getText('" + text.replace('\'', '"') + "')"); } @@ -186,6 +198,7 @@ public class StrutsUtil { } else { key = ognl.findValue(listKey, element); } +key = findValue(listKey, element); Object value = null; @@ -200,6 +213,7 @@ public class StrutsUtil { if ((value != null) && (selectedItems != null) && selectedItems.contains(value)) { isSelected = true; } +value = findValue(listValue, element); selectList.add(new ListEntry(key, value, isSelected)); } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/OgnlTool.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/OgnlTool.java index e77665210..bb9d2b5b8 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/OgnlTool.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/OgnlTool.java @@ -19,16 +19,16 @@ package org.apache.struts2.views.jsp.ui; import com.opensymphony.xwork2.ActionContext; -import ognl.OgnlException; - import com.opensymphony.xwork2.inject.Inject; import com.opensymphony.xwork2.ognl.OgnlUtil; +import ognl.OgnlException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; /** - * FIXME: remove? + * @deprecated since 6.3.0. Use {@link org.apache.struts2.util.StrutsUtil} instead. */ +@Deprecated public class OgnlTool { private static final Logger LOG = LogManager.getLogger(OgnlTool.class); @@ -43,6 +43,10 @@ public class OgnlTool { this.ognlUtil = ognlUtil; } +/** + * @deprecated since 6.3.0. Use {@link org.apache.struts2.util.StrutsUtil#findValue(String, Object)} instead. + */ +@Deprecated public Object findValue(String expr, Object context) { try { return ognlUtil.getValue(expr, ActionContext.getContext().getContextMap(), context); diff --git a/core/src/main/resources/struts-beans.xml b/core/src/main/resources/struts-beans.xml index 7f98e4db5..9d8de3bfb 100644 --- a/core/src/main/resources/struts-beans.xml +++ b/core/src/main/resources/struts-beans.xml @@ -198,7 +198,7 @@ - +
[struts] branch WW-5336-deprecate-ognltool created (now fdf00c1fd)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5336-deprecate-ognltool in repository https://gitbox.apache.org/repos/asf/struts.git at fdf00c1fd WW-5336 Deprecate OGNL in template context This branch includes the following new commits: new 542700e8b WW-5336 Tidy up FreemarkerManager new 028ca92ac WW-5336 Deprecate OgnlTool new 0c524a377 WW-5336 Clean up StrutsUtil new fdf00c1fd WW-5336 Deprecate OGNL in template context The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[struts] 04/04: WW-5336 Deprecate OGNL in template context
This is an automated email from the ASF dual-hosted git repository. kusal pushed a commit to branch WW-5336-deprecate-ognltool in repository https://gitbox.apache.org/repos/asf/struts.git commit fdf00c1fdc62c2a1096ff41cb89f71bd2ebe625a Author: Kusal Kithul-Godage AuthorDate: Mon Aug 21 19:10:40 2023 +1000 WW-5336 Deprecate OGNL in template context --- core/src/main/java/org/apache/struts2/views/util/ContextUtil.java | 8 +++- core/src/main/resources/struts.vm | 2 +- .../java/org/apache/struts2/views/velocity/VelocityManager.java | 6 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java b/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java index f021845d5..97c148f37 100644 --- a/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java +++ b/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java @@ -18,12 +18,9 @@ */ package org.apache.struts2.views.util; -import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionInvocation; import com.opensymphony.xwork2.util.ValueStack; -import org.apache.struts2.StrutsConstants; import org.apache.struts2.util.StrutsUtil; -import org.apache.struts2.views.jsp.ui.OgnlTool; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -50,8 +47,9 @@ public class ContextUtil { map.put(SESSION, req.getSession(false)); map.put(BASE, req.getContextPath()); map.put(STACK, stack); -map.put(OGNL, stack.getActionContext().getContainer().getInstance(OgnlTool.class)); -map.put(STRUTS, new StrutsUtil(stack, req, res)); +StrutsUtil util = new StrutsUtil(stack, req, res); +map.put(STRUTS, util); +map.put(OGNL, util); // Deprecated since 6.3.0 ActionInvocation invocation = stack.getActionContext().getActionInvocation(); if (invocation != null) { diff --git a/core/src/main/resources/struts.vm b/core/src/main/resources/struts.vm index 0b198e990..a92eb70d9 100644 --- a/core/src/main/resources/struts.vm +++ b/core/src/main/resources/struts.vm @@ -33,5 +33,5 @@ #end #macro(property $object $property) -$!{ognl.findValue($property, $object)} +$!{struts.findValue($property, $object)} #end diff --git a/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java b/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java index 9ea9d7a7f..2ad8f1eed 100644 --- a/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java +++ b/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java @@ -54,6 +54,8 @@ import java.util.Properties; import java.util.Set; import java.util.StringTokenizer; +import static org.apache.struts2.views.util.ContextUtil.OGNL; + /** * Manages the environment for Velocity result types */ @@ -136,7 +138,9 @@ public class VelocityManager { for (Map.Entry entry : standardMap.entrySet()) { context.put(entry.getKey(), entry.getValue()); } -context.put(STRUTS, new VelocityStrutsUtil(velocityEngine, context, stack, req, res)); +VelocityStrutsUtil util = new VelocityStrutsUtil(velocityEngine, context, stack, req, res); +context.put(STRUTS, util); +context.put(OGNL, util); // Deprecated since 6.3.0 ServletContext ctx = null; try {
[struts] 03/04: WW-5336 Clean up StrutsUtil
This is an automated email from the ASF dual-hosted git repository. kusal pushed a commit to branch WW-5336-deprecate-ognltool in repository https://gitbox.apache.org/repos/asf/struts.git commit 0c524a37791ad9d9239a971c03e418972895a400 Author: Kusal Kithul-Godage AuthorDate: Mon Aug 21 19:08:12 2023 +1000 WW-5336 Clean up StrutsUtil --- .../java/org/apache/struts2/util/StrutsUtil.java | 126 - .../org/apache/struts2/util/StrutsUtilTest.java| 5 + 2 files changed, 55 insertions(+), 76 deletions(-) diff --git a/core/src/main/java/org/apache/struts2/util/StrutsUtil.java b/core/src/main/java/org/apache/struts2/util/StrutsUtil.java index f9fc43bf3..9946cd944 100644 --- a/core/src/main/java/org/apache/struts2/util/StrutsUtil.java +++ b/core/src/main/java/org/apache/struts2/util/StrutsUtil.java @@ -18,14 +18,16 @@ */ package org.apache.struts2.util; +import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ObjectFactory; +import com.opensymphony.xwork2.ognl.OgnlUtil; import com.opensymphony.xwork2.util.ClassLoaderUtil; import com.opensymphony.xwork2.util.TextParseUtil; import com.opensymphony.xwork2.util.ValueStack; +import ognl.OgnlException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.struts2.StrutsException; -import org.apache.struts2.views.jsp.ui.OgnlTool; import org.apache.struts2.views.util.UrlHelper; import javax.servlet.RequestDispatcher; @@ -39,7 +41,15 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; + +import static java.text.MessageFormat.format; +import static java.util.Collections.singletonList; /** * Struts base utility class, for use in Velocity and Freemarker templates @@ -50,13 +60,12 @@ public class StrutsUtil { protected HttpServletRequest request; protected HttpServletResponse response; -protected Map classes = new Hashtable<>(); -protected OgnlTool ognl; +protected Map> classes = new Hashtable<>(); protected OgnlUtil ognl; protected ValueStack stack; -private UrlHelper urlHelper; -private ObjectFactory objectFactory; +private final UrlHelper urlHelper; +private final ObjectFactory objectFactory; public StrutsUtil(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { this.stack = stack; @@ -67,16 +76,10 @@ public class StrutsUtil { this.objectFactory = stack.getActionContext().getContainer().getInstance(ObjectFactory.class); } -public Object bean(Object aName) throws Exception { -String name = aName.toString(); -Class c = classes.get(name); - -if (c == null) { -c = ClassLoaderUtil.loadClass(name, StrutsUtil.class); -classes.put(name, c); -} - -return objectFactory.buildBean(c, stack.getContext()); +public Object bean(Object name) throws Exception { +String className = name.toString(); +Class clazz = classes.putIfAbsent(className, ClassLoaderUtil.loadClass(className, StrutsUtil.class)); +return objectFactory.buildBean(clazz, stack.getContext()); } public boolean isTrue(String expression) { @@ -89,30 +92,20 @@ public class StrutsUtil { } public String include(Object aName) throws Exception { -try { -RequestDispatcher dispatcher = request.getRequestDispatcher(aName.toString()); - -if (dispatcher == null) { -throw new IllegalArgumentException("Cannot find included file " + aName); -} - -ResponseWrapper responseWrapper = new ResponseWrapper(response); - -dispatcher.include(request, responseWrapper); - -return responseWrapper.getData(); -} -catch (Exception e) { -LOG.debug("Cannot include {}", aName, e); -throw e; +RequestDispatcher dispatcher = request.getRequestDispatcher(aName.toString()); +if (dispatcher == null) { +throw new IllegalArgumentException("Cannot find included file " + aName); } +ResponseWrapper responseWrapper = new ResponseWrapper(response); +dispatcher.include(request, responseWrapper); +return responseWrapper.getData(); } public String urlEncode(String s) { try { return URLEncoder.encode(s, "UTF-8"); } catch (UnsupportedEncodingException e) { -LOG.debug("Cannot encode URL [{}]", s, e); +LOG.debug(format("Cannot encode URL [{0}]", s), e); return s; } } @@ -144,7 +137,7 @@ public class StrutsUtil { * @return the url ContextPath. An empty string if one does not
[struts] 01/04: WW-5336 Tidy up FreemarkerManager
This is an automated email from the ASF dual-hosted git repository. kusal pushed a commit to branch WW-5336-deprecate-ognltool in repository https://gitbox.apache.org/repos/asf/struts.git commit 542700e8b11ed704495775fdb5b2ef41cc9e93e6 Author: Kusal Kithul-Godage AuthorDate: Mon Aug 21 19:04:10 2023 +1000 WW-5336 Tidy up FreemarkerManager --- .../views/freemarker/FreemarkerManager.java| 40 +++--- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java index 7f72d0b1f..62c7cc9ae 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java @@ -24,16 +24,24 @@ import com.opensymphony.xwork2.inject.Container; import com.opensymphony.xwork2.inject.Inject; import com.opensymphony.xwork2.util.ClassLoaderUtil; import com.opensymphony.xwork2.util.ValueStack; -import freemarker.cache.*; +import freemarker.cache.ClassTemplateLoader; +import freemarker.cache.FileTemplateLoader; +import freemarker.cache.MultiTemplateLoader; +import freemarker.cache.TemplateLoader; +import freemarker.cache.WebappTemplateLoader; import freemarker.core.HTMLOutputFormat; -import freemarker.core.OutputFormat; import freemarker.core.TemplateClassResolver; import freemarker.ext.jsp.TaglibFactory; import freemarker.ext.servlet.HttpRequestHashModel; import freemarker.ext.servlet.HttpRequestParametersHashModel; import freemarker.ext.servlet.HttpSessionHashModel; import freemarker.ext.servlet.ServletContextHashModel; -import freemarker.template.*; +import freemarker.template.Configuration; +import freemarker.template.ObjectWrapper; +import freemarker.template.TemplateException; +import freemarker.template.TemplateExceptionHandler; +import freemarker.template.TemplateModel; +import freemarker.template.Version; import freemarker.template.utility.StringUtil; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -51,7 +59,13 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.Calendar; +import java.util.Collections; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.Set; /** * @@ -176,27 +190,27 @@ public class FreemarkerManager { public void setEncoding(String encoding) { this.encoding = encoding; } - + @Inject(StrutsConstants.STRUTS_FREEMARKER_WRAPPER_ALT_MAP) public void setWrapperAltMap(String val) { altMapWrapper = "true".equals(val); } - + @Inject(StrutsConstants.STRUTS_FREEMARKER_BEANWRAPPER_CACHE) public void setCacheBeanWrapper(String val) { cacheBeanWrapper = "true".equals(val); } - + @Inject(StrutsConstants.STRUTS_FREEMARKER_MRU_MAX_STRONG_SIZE) public void setMruMaxStrongSize(String size) { mruMaxStrongSize = Integer.parseInt(size); } - + @Inject(value = StrutsConstants.STRUTS_FREEMARKER_TEMPLATES_CACHE_UPDATE_DELAY, required = false) public void setTemplateUpdateDelay(String delay) { templateUpdateDelay = delay; } - + @Inject public void setContainer(Container container) { Map map = new HashMap<>(); @@ -281,8 +295,8 @@ public class FreemarkerManager { loadSettings(servletContext); } -/** - * Sets the Freemarker Configuration's template loader with the FreemarkerThemeTemplateLoader +/** + * Sets the Freemarker Configuration's template loader with the FreemarkerThemeTemplateLoader * at the top. * * @param templateLoader the template loader @@ -293,7 +307,7 @@ public class FreemarkerManager { themeTemplateLoader.init(templateLoader); config.setTemplateLoader(themeTemplateLoader); } - + /** * Create the instance of the freemarker Configuration object. * @@ -543,7 +557,7 @@ public class FreemarkerManager { protected void populateContext(ScopesHashModel model, ValueStack stack, Object action, HttpServletRequest request, HttpServletResponse response) { // put the same objects into the context that the velocity result uses -Map standard = ContextUtil.getStandardContext(stack, request, response); +Map standard = ContextUtil.getStandardContext(stack, request, response); model.putAll(standard); // support for JSP exception pages, exposing the servlet or JSP exception
[struts] branch fix/WW-5331-proper-get updated: WW-5331 Adds missing @Override annotations
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch fix/WW-5331-proper-get in repository https://gitbox.apache.org/repos/asf/struts.git The following commit(s) were added to refs/heads/fix/WW-5331-proper-get by this push: new 4a678f6bb WW-5331 Adds missing @Override annotations 4a678f6bb is described below commit 4a678f6bbbe240ee6ee4e85161e487163ab7f475 Author: Lukasz Lenart AuthorDate: Mon Aug 21 15:06:44 2023 +0200 WW-5331 Adds missing @Override annotations --- .../main/java/org/apache/struts2/dispatcher/ApplicationMap.java| 4 ++-- .../java/org/apache/struts2/portlet/PortletApplicationMap.java | 7 +-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ApplicationMap.java b/core/src/main/java/org/apache/struts2/dispatcher/ApplicationMap.java index e678d9ec5..f0c5b4bf2 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ApplicationMap.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ApplicationMap.java @@ -36,10 +36,9 @@ public class ApplicationMap extends AbstractMap implements Seria private static final long serialVersionUID = 9136809763083228202L; -private ServletContext context; +private final ServletContext context; private Set> entries; - /** * Creates a new map object given the servlet context. * @@ -117,6 +116,7 @@ public class ApplicationMap extends AbstractMap implements Seria * @param key the entry key. * @return the servlet context attribute or init parameter or null if the entry is not found. */ +@Override public Object get(final Object key) { if (key == null) { return null; diff --git a/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java b/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java index 73d432390..701deb004 100644 --- a/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java +++ b/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java @@ -35,8 +35,7 @@ public class PortletApplicationMap extends AbstractMap implement private static final long serialVersionUID = 2296107511063504414L; -private PortletContext context; - +private final PortletContext context; private Set> entries; /** @@ -52,6 +51,7 @@ public class PortletApplicationMap extends AbstractMap implement * Removes all entries from the Map and removes all attributes from the * portlet context. */ +@Override public void clear() { entries = null; @@ -69,6 +69,7 @@ public class PortletApplicationMap extends AbstractMap implement * @return a Set of all portlet context attributes as well as context init * parameters. */ +@Override public Set> entrySet() { if (entries == null) { entries = new HashSet>(); @@ -160,6 +161,7 @@ public class PortletApplicationMap extends AbstractMap implement * @return the portlet context attribute or init parameter or null * if the entry is not found. */ +@Override public Object get(Object key) { if (key == null) { return null; @@ -180,6 +182,7 @@ public class PortletApplicationMap extends AbstractMap implement *the value to set. * @return the attribute that was just set. */ +@Override public Object put(String key, Object value) { entries = null; context.setAttribute(key, value);
[struts] branch WW-5337-exclusion-performance created (now 72a5d2133)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5337-exclusion-performance in repository https://gitbox.apache.org/repos/asf/struts.git at 72a5d2133 WW-5337 Update struts-excluded-classes.xml to not have trailing periods This branch includes the following new commits: new bb68ce6ae WW-5337 Catch PatternSyntaxException and ensure ConfigurationException thrown new 393eb8c0f WW-5337 Minor clean up OgnlUtil new 841705cad WW-5337 Strip trailing periods from package names provided as not needed new 4145d1af1 WW-5337 Make #isExcludedPackageNamePatterns more succinct new e53dd7dd5 WW-5337 Make #isClassExcluded (semantics changes) and #isExcludedPackageExempt constant time new 746c75413 WW-5337 Make #isExcludedPackageNames runtime proportional to no. of package parts rather than no. of excluded packages new 72a5d2133 WW-5337 Update struts-excluded-classes.xml to not have trailing periods The 7 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[struts] 04/07: WW-5337 Make #isExcludedPackageNamePatterns more succinct
This is an automated email from the ASF dual-hosted git repository. kusal pushed a commit to branch WW-5337-exclusion-performance in repository https://gitbox.apache.org/repos/asf/struts.git commit 4145d1af14a1b39dd0970159171f24058d845834 Author: Kusal Kithul-Godage AuthorDate: Mon Aug 21 23:33:52 2023 +1000 WW-5337 Make #isExcludedPackageNamePatterns more succinct --- .../java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java| 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java b/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java index 18acc675c..d90e58308 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java +++ b/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java @@ -237,12 +237,7 @@ public class SecurityMemberAccess implements MemberAccess { protected boolean isExcludedPackageNamePatterns(Class clazz) { String packageName = toPackageName(clazz); -for (Pattern pattern : excludedPackageNamePatterns) { -if (pattern.matcher(packageName).matches()) { -return true; -} -} -return false; +return excludedPackageNamePatterns.stream().anyMatch(pattern -> pattern.matcher(packageName).matches()); } protected boolean isExcludedPackageNames(Class clazz) {
[struts] 03/07: WW-5337 Strip trailing periods from package names provided as not needed
This is an automated email from the ASF dual-hosted git repository. kusal pushed a commit to branch WW-5337-exclusion-performance in repository https://gitbox.apache.org/repos/asf/struts.git commit 841705cadfd38b5460915375b5e977131f3988eb Author: Kusal Kithul-Godage AuthorDate: Mon Aug 21 23:33:30 2023 +1000 WW-5337 Strip trailing periods from package names provided as not needed --- core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) 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 21ebd5fea..005d17eba 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java +++ b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java @@ -53,6 +53,8 @@ import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; import static com.opensymphony.xwork2.util.TextParseUtil.commaDelimitedStringToSet; +import static java.util.stream.Collectors.toSet; +import static org.apache.commons.lang3.StringUtils.strip; /** @@ -260,7 +262,8 @@ public class OgnlUtil { } private Set parseExcludedPackageNames(String commaDelimitedPackageNames) { -Set parsedSet = TextParseUtil.commaDelimitedStringToSet(commaDelimitedPackageNames); +Set parsedSet = commaDelimitedStringToSet(commaDelimitedPackageNames) +.stream().map(s -> strip(s, ".")).collect(toSet()); if (parsedSet.stream().anyMatch(s -> s.matches("(.*?)\\s(.*?)"))) { throw new ConfigurationException("Excluded package names could not be parsed due to erroneous whitespace characters: " + commaDelimitedPackageNames); }
[struts] 02/07: WW-5337 Minor clean up OgnlUtil
This is an automated email from the ASF dual-hosted git repository. kusal pushed a commit to branch WW-5337-exclusion-performance in repository https://gitbox.apache.org/repos/asf/struts.git commit 393eb8c0f89f802dffb7c6d0d20da4bdfd73fa82 Author: Kusal Kithul-Godage AuthorDate: Mon Aug 21 23:32:04 2023 +1000 WW-5337 Minor clean up OgnlUtil --- core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) 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 be738be93..21ebd5fea 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java +++ b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java @@ -24,7 +24,6 @@ import com.opensymphony.xwork2.inject.Container; import com.opensymphony.xwork2.inject.Inject; import com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor; import com.opensymphony.xwork2.util.CompoundRoot; -import com.opensymphony.xwork2.util.TextParseUtil; import com.opensymphony.xwork2.util.reflection.ReflectionException; import ognl.ClassResolver; import ognl.Ognl; @@ -190,9 +189,8 @@ public class OgnlUtil { } private Set> parseClasses(String commaDelimitedClasses) { -Set classNames = TextParseUtil.commaDelimitedStringToSet(commaDelimitedClasses); +Set classNames = commaDelimitedStringToSet(commaDelimitedClasses); Set> classes = new HashSet<>(); - for (String className : classNames) { try { classes.add(Class.forName(className)); @@ -200,7 +198,6 @@ public class OgnlUtil { throw new ConfigurationException("Cannot load class for exclusion/exemption configuration: " + className, e); } } - return classes; }
[struts] 06/07: WW-5337 Make #isExcludedPackageNames runtime proportional to no. of package parts rather than no. of excluded packages
This is an automated email from the ASF dual-hosted git repository. kusal pushed a commit to branch WW-5337-exclusion-performance in repository https://gitbox.apache.org/repos/asf/struts.git commit 746c7541326ba809f16bceef8fea4215793b5d62 Author: Kusal Kithul-Godage AuthorDate: Mon Aug 21 23:37:32 2023 +1000 WW-5337 Make #isExcludedPackageNames runtime proportional to no. of package parts rather than no. of excluded packages --- .../com/opensymphony/xwork2/ognl/SecurityMemberAccess.java | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java b/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java index 3b870dedd..29d15ebf9 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java +++ b/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java @@ -27,8 +27,10 @@ import java.lang.reflect.AccessibleObject; import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Modifier; +import java.util.Arrays; import java.util.Collections; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.regex.Matcher; @@ -241,9 +243,11 @@ public class SecurityMemberAccess implements MemberAccess { } protected boolean isExcludedPackageNames(Class clazz) { -String suffixedPackageName = toPackageName(clazz) + "."; -for (String excludedPackageName : excludedPackageNames) { -if (suffixedPackageName.startsWith(excludedPackageName)) { +String packageName = toPackageName(clazz); +List packageParts = Arrays.asList(packageName.split("\\.")); +for (int i = 0; i < packageParts.size(); i++) { +String parentPackage = String.join(".", packageParts.subList(0, i + 1)); +if (excludedPackageNames.contains(parentPackage)) { return true; } }
[struts] 05/07: WW-5337 Make #isClassExcluded (semantics changes) and #isExcludedPackageExempt constant time
This is an automated email from the ASF dual-hosted git repository. kusal pushed a commit to branch WW-5337-exclusion-performance in repository https://gitbox.apache.org/repos/asf/struts.git commit e53dd7dd5e8f0f8d9aa3244180cb6394bb00ed07 Author: Kusal Kithul-Godage AuthorDate: Mon Aug 21 23:34:47 2023 +1000 WW-5337 Make #isClassExcluded (semantics changes) and #isExcludedPackageExempt constant time --- .../java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java b/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java index d90e58308..3b870dedd 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java +++ b/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java @@ -251,14 +251,14 @@ public class SecurityMemberAccess implements MemberAccess { } protected boolean isClassExcluded(Class clazz) { -if (clazz == Object.class || (clazz == Class.class && !allowStaticFieldAccess)) { +if (clazz == Class.class && !allowStaticFieldAccess) { return true; } -return excludedClasses.stream().anyMatch(clazz::isAssignableFrom); +return excludedClasses.contains(clazz); } protected boolean isExcludedPackageExempt(Class clazz) { -return excludedPackageExemptClasses.stream().anyMatch(clazz::equals); +return excludedPackageExemptClasses.contains(clazz); } protected boolean isAcceptableProperty(String name) {
[struts] 01/07: WW-5337 Catch PatternSyntaxException and ensure ConfigurationException thrown
This is an automated email from the ASF dual-hosted git repository. kusal pushed a commit to branch WW-5337-exclusion-performance in repository https://gitbox.apache.org/repos/asf/struts.git commit bb68ce6ae5a3cff8f35844f4533c4007370c30e8 Author: Kusal Kithul-Godage AuthorDate: Mon Aug 21 23:31:31 2023 +1000 WW-5337 Catch PatternSyntaxException and ensure ConfigurationException thrown --- .../main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) 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 c6169afa9..be738be93 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java +++ b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java @@ -51,6 +51,9 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; + +import static com.opensymphony.xwork2.util.TextParseUtil.commaDelimitedStringToSet; /** @@ -218,14 +221,13 @@ public class OgnlUtil { } private Set parseExcludedPackageNamePatterns(String commaDelimitedPackagePatterns) { -Set packagePatterns = TextParseUtil.commaDelimitedStringToSet(commaDelimitedPackagePatterns); -Set packageNamePatterns = new HashSet<>(); - -for (String pattern : packagePatterns) { -packageNamePatterns.add(Pattern.compile(pattern)); +try { +return commaDelimitedStringToSet(commaDelimitedPackagePatterns) +.stream().map(Pattern::compile).collect(toSet()); +} catch (PatternSyntaxException e) { +throw new ConfigurationException( +"Excluded package name patterns could not be parsed due to invalid regex: " + commaDelimitedPackagePatterns, e); } - -return packageNamePatterns; } @Inject(value = StrutsConstants.STRUTS_EXCLUDED_PACKAGE_NAMES, required = false)
[struts] 07/07: WW-5337 Update struts-excluded-classes.xml to not have trailing periods
This is an automated email from the ASF dual-hosted git repository. kusal pushed a commit to branch WW-5337-exclusion-performance in repository https://gitbox.apache.org/repos/asf/struts.git commit 72a5d213327ab612029e5f58d1131ae116098c1f Author: Kusal Kithul-Godage AuthorDate: Mon Aug 21 23:38:15 2023 +1000 WW-5337 Update struts-excluded-classes.xml to not have trailing periods --- .../src/main/resources/struts-excluded-classes.xml | 84 +++--- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/core/src/main/resources/struts-excluded-classes.xml b/core/src/main/resources/struts-excluded-classes.xml index 6e4957273..72df88c89 100644 --- a/core/src/main/resources/struts-excluded-classes.xml +++ b/core/src/main/resources/struts-excluded-classes.xml @@ -55,52 +55,52 @@ - + +ognl, +java.io, +java.net, +java.nio, +javax, +freemarker.core, +freemarker.template, +freemarker.ext.jsp, +freemarker.ext.rhino, +sun.misc, +sun.reflect, +javassist, +org.apache.velocity, +org.objectweb.asm, +org.springframework.context, +com.opensymphony.xwork2.inject, +com.opensymphony.xwork2.ognl, +com.opensymphony.xwork2.security, +com.opensymphony.xwork2.util, +org.apache.tomcat, +org.apache.catalina.core, +org.wildfly.extension.undertow.deployment"/> +ognl, +java.io, +java.net, +java.nio, +javax, +freemarker.core, +freemarker.template, +freemarker.ext.jsp, +freemarker.ext.rhino, +sun.misc, +sun.reflect, +javassist, +org.apache.velocity, +org.objectweb.asm, +org.springframework.context, +com.opensymphony.xwork2.inject, +com.opensymphony.xwork2.ognl, +com.opensymphony.xwork2.security, +com.opensymphony.xwork2.util"/>
[struts] branch master updated (ea124a475 -> f31ba637c)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/struts.git from ea124a475 Merge pull request #732 from apache/WW-5334-fix-cyclic add 298eefe8c WW-5331 Uses proper signature of get() add 5aa1d076b Increases wait time to avoid failing test add e1a80789f WW-5331 Covers new logic with tests add e8287ddee WW-5331 Adds missing header with licence add 710ec2edb WW-5331 Adds tests covering ApplicationMap add 4a678f6bb WW-5331 Adds missing @Override annotations new f31ba637c Merge pull request #727 from apache/fix/WW-5331-proper-get The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../apache/struts2/dispatcher/ApplicationMap.java | 13 +-- .../org/apache/struts2/dispatcher/RequestMap.java | 8 +- .../org/apache/struts2/views/jsp/TagUtils.java | 4 +- .../struts2/dispatcher/ApplicationMapTest.java | 93 ++ .../apache/struts2/dispatcher/RequestMapTest.java | 93 ++ .../exec/StrutsBackgroundProcessTest.java | 2 +- .../struts2/portlet/PortletApplicationMap.java | 16 ++-- .../apache/struts2/portlet/PortletRequestMap.java | 3 + .../apache/struts2/portlet/PortletSessionMap.java | 2 +- 9 files changed, 217 insertions(+), 17 deletions(-) create mode 100644 core/src/test/java/org/apache/struts2/dispatcher/ApplicationMapTest.java create mode 100644 core/src/test/java/org/apache/struts2/dispatcher/RequestMapTest.java
[struts] 01/01: Merge pull request #727 from apache/fix/WW-5331-proper-get
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/struts.git commit f31ba637c863a3eec37eea9da9bb7b646538a3aa Merge: ea124a475 4a678f6bb Author: Lukasz Lenart AuthorDate: Mon Aug 21 15:39:16 2023 +0200 Merge pull request #727 from apache/fix/WW-5331-proper-get [WW-5331] Uses proper signature of get() .../apache/struts2/dispatcher/ApplicationMap.java | 13 +-- .../org/apache/struts2/dispatcher/RequestMap.java | 8 +- .../org/apache/struts2/views/jsp/TagUtils.java | 4 +- .../struts2/dispatcher/ApplicationMapTest.java | 93 ++ .../apache/struts2/dispatcher/RequestMapTest.java | 93 ++ .../exec/StrutsBackgroundProcessTest.java | 2 +- .../struts2/portlet/PortletApplicationMap.java | 16 ++-- .../apache/struts2/portlet/PortletRequestMap.java | 3 + .../apache/struts2/portlet/PortletSessionMap.java | 2 +- 9 files changed, 217 insertions(+), 17 deletions(-)
[struts] branch fix/WW-5331-proper-get deleted (was 4a678f6bb)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch fix/WW-5331-proper-get in repository https://gitbox.apache.org/repos/asf/struts.git was 4a678f6bb WW-5331 Adds missing @Override annotations The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[struts] branch WW-5336-deprecate-ognltool updated (fdf00c1fd -> 23abcf7eb)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5336-deprecate-ognltool in repository https://gitbox.apache.org/repos/asf/struts.git omit fdf00c1fd WW-5336 Deprecate OGNL in template context omit 0c524a377 WW-5336 Clean up StrutsUtil add 7469eecc4 WW-5336 Clean up StrutsUtil add 23abcf7eb WW-5336 Deprecate OGNL in template context This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (fdf00c1fd) \ N -- N -- N refs/heads/WW-5336-deprecate-ognltool (23abcf7eb) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: .../java/org/apache/struts2/util/StrutsUtil.java | 6 +- .../org/apache/struts2/util/StrutsUtilTest.java| 24 +++--- 2 files changed, 17 insertions(+), 13 deletions(-)
[struts] branch WW-5337-exclusion-performance updated (72a5d2133 -> 270ec4ad7)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5337-exclusion-performance in repository https://gitbox.apache.org/repos/asf/struts.git from 72a5d2133 WW-5337 Update struts-excluded-classes.xml to not have trailing periods add b0f1ef1f8 WW-5337 Revert Object special handling add a228b14a4 WW-5337 Drop superinterface/superclass banning test add 270ec4ad7 WW-5337 Fix #testPackageNameExclusionAsCommaDelimited No new revisions were added by this update. Summary of changes: .../xwork2/ognl/SecurityMemberAccess.java | 2 +- .../xwork2/ognl/SecurityMemberAccessTest.java | 19 +-- 2 files changed, 2 insertions(+), 19 deletions(-)
[struts] branch WW-5336-deprecate-ognltool updated (23abcf7eb -> 8832865b2)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5336-deprecate-ognltool in repository https://gitbox.apache.org/repos/asf/struts.git from 23abcf7eb WW-5336 Deprecate OGNL in template context add 8832865b2 WW-5336 Reduce cognitive complexity #makeSelectList No new revisions were added by this update. Summary of changes: .../java/org/apache/struts2/util/StrutsUtil.java | 58 +++--- 1 file changed, 30 insertions(+), 28 deletions(-)
[struts] branch WW-5337-exclusion-performance updated (270ec4ad7 -> 783063c66)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5337-exclusion-performance in repository https://gitbox.apache.org/repos/asf/struts.git from 270ec4ad7 WW-5337 Fix #testPackageNameExclusionAsCommaDelimited add 783063c66 WW-5337 Initialise default exclusions one-time in SecurityMemberAccess (more performant) No new revisions were added by this update. Summary of changes: .../xwork2/ognl/SecurityMemberAccess.java | 29 +- 1 file changed, 17 insertions(+), 12 deletions(-)
[struts] branch WW-5334-move-convention-test deleted (was dc43c891d)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5334-move-convention-test in repository https://gitbox.apache.org/repos/asf/struts.git was dc43c891d WW-5334 Extract ConventionJUnit4Test into correct module The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[struts] branch master updated (f31ba637c -> 94a3e6bd9)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/struts.git from f31ba637c Merge pull request #727 from apache/fix/WW-5331-proper-get add dc43c891d WW-5334 Extract ConventionJUnit4Test into correct module add 94a3e6bd9 Merge pull request #733 from apache/WW-5334-move-convention-test No new revisions were added by this update. Summary of changes: plugins/convention/pom.xml | 15 + .../src/test/java/actions/MessageAction.java} | 5 +-- .../struts2/convention/ConventionJUnit4Test.java} | 11 +++ .../src/test/resources/message-success.ftl}| 0 .../resources/struts-convention-configuration.xml} | 5 +-- plugins/junit/pom.xml | 14 .../resources/struts-convention-configuration.xml | 38 -- pom.xml| 5 +++ 8 files changed, 31 insertions(+), 62 deletions(-) rename plugins/{junit/src/test/java/actions/ViewAction.java => convention/src/test/java/actions/MessageAction.java} (85%) rename plugins/{junit/src/test/java/org/apache/struts2/junit/convention/StrutsJUnit4ConventionTestCaseTest.java => convention/src/test/java/org/apache/struts2/convention/ConventionJUnit4Test.java} (86%) rename plugins/{junit/src/test/resources/view-success.ftl => convention/src/test/resources/message-success.ftl} (100%) copy plugins/{velocity/src/main/resources/struts-deferred.xml => convention/src/test/resources/struts-convention-configuration.xml} (88%) delete mode 100644 plugins/junit/src/test/resources/struts-convention-configuration.xml
[struts] branch master updated (94a3e6bd9 -> 87f80f473)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/struts.git from 94a3e6bd9 Merge pull request #733 from apache/WW-5334-move-convention-test add 3f558a8cf Defines a proper CODEOWNERS file https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners new 87f80f473 Merge pull request #728 from apache/feature/codeowners The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: CODEOWNERS | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 CODEOWNERS
[struts] 01/01: Merge pull request #728 from apache/feature/codeowners
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/struts.git commit 87f80f4738971780bccca84357638acaa28e490a Merge: 94a3e6bd9 3f558a8cf Author: Lukasz Lenart AuthorDate: Mon Aug 21 20:41:30 2023 +0200 Merge pull request #728 from apache/feature/codeowners Defines a proper CODEOWNERS file CODEOWNERS | 2 ++ 1 file changed, 2 insertions(+)
[struts] branch feature/codeowners deleted (was 3f558a8cf)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch feature/codeowners in repository https://gitbox.apache.org/repos/asf/struts.git was 3f558a8cf Defines a proper CODEOWNERS file https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[struts] branch master updated (87f80f473 -> 0ef086c89)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/struts.git from 87f80f473 Merge pull request #728 from apache/feature/codeowners add 2d6fe8430 WW-5334 Remove unused imports ContextUtil add f4daeb3ea WW-5334 Clean up VelocityStrutsUtil add 114b6e4f2 WW-5334 Clean up VelocityManager#applyDefaultConfiguration add 2abf8677b WW-5334 Clean up VelocityManager context creation add 6d9bfb6af WW-5334 Remove unused import XWorkTestCase add 225063960 WW-5334 Modernise VelocityResultTest add 2fa9d60a2 WW-5334 Add basic unit tests for VelocityManager add d70ad5b73 WW-5334 Fix license for VelocityManagerTest add 94c1b2a29 WW-5334 Add AssertJ as default plugin test dependency add 22a6ae9d6 WW-5334 Add further unit tests to VelocityManagerTest new 0ef086c89 Merge pull request #731 from apache/WW-5334-velocity-manager The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../com/opensymphony/xwork2/XWorkTestCase.java | 7 +- .../org/apache/struts2/views/util/ContextUtil.java | 2 - plugins/json/pom.xml | 6 - plugins/pom.xml| 5 + plugins/rest/pom.xml | 6 - .../struts2/views/velocity/VelocityManager.java| 186 +++-- .../struts2/views/velocity/VelocityStrutsUtil.java | 16 +- .../views/velocity/VelocityManagerTest.java| 116 + .../views/velocity/result/VelocityResultTest.java | 102 +-- .../main => velocity/src/test}/resources/tools.xml | 6 +- 10 files changed, 249 insertions(+), 203 deletions(-) create mode 100644 plugins/velocity/src/test/java/org/apache/struts2/views/velocity/VelocityManagerTest.java copy plugins/{tiles/src/main => velocity/src/test}/resources/tools.xml (84%)
[struts] 01/01: Merge pull request #731 from apache/WW-5334-velocity-manager
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/struts.git commit 0ef086c89b6c1d7ae3d71c38a1081ec2830a9946 Merge: 87f80f473 22a6ae9d6 Author: Lukasz Lenart AuthorDate: Mon Aug 21 21:06:20 2023 +0200 Merge pull request #731 from apache/WW-5334-velocity-manager WW-5334 Misc VelocityManager code cleanup .../com/opensymphony/xwork2/XWorkTestCase.java | 7 +- .../org/apache/struts2/views/util/ContextUtil.java | 2 - plugins/json/pom.xml | 6 - plugins/pom.xml| 5 + plugins/rest/pom.xml | 6 - .../struts2/views/velocity/VelocityManager.java| 186 +++-- .../struts2/views/velocity/VelocityStrutsUtil.java | 16 +- .../views/velocity/VelocityManagerTest.java| 116 + .../views/velocity/result/VelocityResultTest.java | 102 +-- plugins/velocity/src/test/resources/tools.xml | 20 +++ 10 files changed, 268 insertions(+), 198 deletions(-)
[struts] branch WW-5334-velocity-manager deleted (was 22a6ae9d6)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch WW-5334-velocity-manager in repository https://gitbox.apache.org/repos/asf/struts.git was 22a6ae9d6 WW-5334 Add further unit tests to VelocityManagerTest The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[struts] branch WW-5337-exclusion-performance deleted (was 783063c66)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5337-exclusion-performance in repository https://gitbox.apache.org/repos/asf/struts.git was 783063c66 WW-5337 Initialise default exclusions one-time in SecurityMemberAccess (more performant) The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[struts] branch master updated (0ef086c89 -> e75f8d82b)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/struts.git from 0ef086c89 Merge pull request #731 from apache/WW-5334-velocity-manager add bb68ce6ae WW-5337 Catch PatternSyntaxException and ensure ConfigurationException thrown add 393eb8c0f WW-5337 Minor clean up OgnlUtil add 841705cad WW-5337 Strip trailing periods from package names provided as not needed add 4145d1af1 WW-5337 Make #isExcludedPackageNamePatterns more succinct add e53dd7dd5 WW-5337 Make #isClassExcluded (semantics changes) and #isExcludedPackageExempt constant time add 746c75413 WW-5337 Make #isExcludedPackageNames runtime proportional to no. of package parts rather than no. of excluded packages add 72a5d2133 WW-5337 Update struts-excluded-classes.xml to not have trailing periods add b0f1ef1f8 WW-5337 Revert Object special handling add a228b14a4 WW-5337 Drop superinterface/superclass banning test add 270ec4ad7 WW-5337 Fix #testPackageNameExclusionAsCommaDelimited add 783063c66 WW-5337 Initialise default exclusions one-time in SecurityMemberAccess (more performant) add e75f8d82b Merge pull request #736 from apache/WW-5337-exclusion-performance No new revisions were added by this update. Summary of changes: .../com/opensymphony/xwork2/ognl/OgnlUtil.java | 26 +++ .../xwork2/ognl/SecurityMemberAccess.java | 50 +++-- .../src/main/resources/struts-excluded-classes.xml | 84 +++--- .../xwork2/ognl/SecurityMemberAccessTest.java | 19 + 4 files changed, 84 insertions(+), 95 deletions(-)
[struts] branch WW-5336-deprecate-ognltool updated (8832865b2 -> ba44510fc)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5336-deprecate-ognltool in repository https://gitbox.apache.org/repos/asf/struts.git discard 8832865b2 WW-5336 Reduce cognitive complexity #makeSelectList discard 23abcf7eb WW-5336 Deprecate OGNL in template context discard 7469eecc4 WW-5336 Clean up StrutsUtil discard 028ca92ac WW-5336 Deprecate OgnlTool discard 542700e8b WW-5336 Tidy up FreemarkerManager add 298eefe8c WW-5331 Uses proper signature of get() add 5aa1d076b Increases wait time to avoid failing test add e1a80789f WW-5331 Covers new logic with tests add e8287ddee WW-5331 Adds missing header with licence add 710ec2edb WW-5331 Adds tests covering ApplicationMap add 4a678f6bb WW-5331 Adds missing @Override annotations add f31ba637c Merge pull request #727 from apache/fix/WW-5331-proper-get add dc43c891d WW-5334 Extract ConventionJUnit4Test into correct module add 94a3e6bd9 Merge pull request #733 from apache/WW-5334-move-convention-test add 3f558a8cf Defines a proper CODEOWNERS file https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners add 87f80f473 Merge pull request #728 from apache/feature/codeowners add 2d6fe8430 WW-5334 Remove unused imports ContextUtil add f4daeb3ea WW-5334 Clean up VelocityStrutsUtil add 114b6e4f2 WW-5334 Clean up VelocityManager#applyDefaultConfiguration add 2abf8677b WW-5334 Clean up VelocityManager context creation add 6d9bfb6af WW-5334 Remove unused import XWorkTestCase add 225063960 WW-5334 Modernise VelocityResultTest add 2fa9d60a2 WW-5334 Add basic unit tests for VelocityManager add d70ad5b73 WW-5334 Fix license for VelocityManagerTest add 94c1b2a29 WW-5334 Add AssertJ as default plugin test dependency add 22a6ae9d6 WW-5334 Add further unit tests to VelocityManagerTest add 0ef086c89 Merge pull request #731 from apache/WW-5334-velocity-manager add bb68ce6ae WW-5337 Catch PatternSyntaxException and ensure ConfigurationException thrown add 393eb8c0f WW-5337 Minor clean up OgnlUtil add 841705cad WW-5337 Strip trailing periods from package names provided as not needed add 4145d1af1 WW-5337 Make #isExcludedPackageNamePatterns more succinct add e53dd7dd5 WW-5337 Make #isClassExcluded (semantics changes) and #isExcludedPackageExempt constant time add 746c75413 WW-5337 Make #isExcludedPackageNames runtime proportional to no. of package parts rather than no. of excluded packages add 72a5d2133 WW-5337 Update struts-excluded-classes.xml to not have trailing periods add b0f1ef1f8 WW-5337 Revert Object special handling add a228b14a4 WW-5337 Drop superinterface/superclass banning test add 270ec4ad7 WW-5337 Fix #testPackageNameExclusionAsCommaDelimited add 783063c66 WW-5337 Initialise default exclusions one-time in SecurityMemberAccess (more performant) add e75f8d82b Merge pull request #736 from apache/WW-5337-exclusion-performance add 709434eeb WW-5336 Tidy up FreemarkerManager add e8614a99d WW-5336 Deprecate OgnlTool add 79e950fe7 WW-5336 Clean up StrutsUtil add 51345dbe5 WW-5336 Deprecate OGNL in template context add ba44510fc WW-5336 Reduce cognitive complexity #makeSelectList This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (8832865b2) \ N -- N -- N refs/heads/WW-5336-deprecate-ognltool (ba44510fc) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: CODEOWNERS | 2 + .../com/opensymphony/xwork2/XWorkTestCase.java | 7 +- .../com/opensymphony/xwork2/ognl/OgnlUtil.java | 26 +-- .../xwork2/ognl/SecurityMemberAccess.java | 50 +++--- .../apache/struts2/dispatcher/ApplicationMap.java | 13 +- .../org/apache/struts2/dispatcher/RequestMap.java | 8 +- .../org/apache/struts2/views/jsp/TagUtils.java | 4 +- .../src/main/resources/struts-excluded-classes.xml | 84 +- .../xwork2/ognl/SecurityMemberAccessTest.java | 19 +-- .../struts2/dispatcher/ApplicationMapTest.java | 93 +++ .../apache/struts2/dispatcher/RequestMapTest.java | 93 +++ .../exec/StrutsBackgroundProcessTest.java | 2 +- plugins/convention/pom.xml
[struts] branch WW-5336-deprecate-ognltool updated (ba44510fc -> 518d2ac1a)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5336-deprecate-ognltool in repository https://gitbox.apache.org/repos/asf/struts.git from ba44510fc WW-5336 Reduce cognitive complexity #makeSelectList add 518d2ac1a WW-5336 Switch to HashMap as concurrency handling not required No new revisions were added by this update. Summary of changes: core/src/main/java/org/apache/struts2/util/StrutsUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
[struts] branch WW-5336-deprecate-ognltool updated (518d2ac1a -> 740cb68e8)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5336-deprecate-ognltool in repository https://gitbox.apache.org/repos/asf/struts.git discard 518d2ac1a WW-5336 Switch to HashMap as concurrency handling not required discard ba44510fc WW-5336 Reduce cognitive complexity #makeSelectList discard 51345dbe5 WW-5336 Deprecate OGNL in template context add 9f4b84cca WW-5336 Deprecate OGNL in template context add 83c555af5 WW-5336 Reduce cognitive complexity #makeSelectList add 740cb68e8 WW-5336 Switch to HashMap as concurrency handling not required This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (518d2ac1a) \ N -- N -- N refs/heads/WW-5336-deprecate-ognltool (740cb68e8) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: .../java/org/apache/struts2/views/velocity/VelocityManagerTest.java| 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
[struts] branch WW-5336-deprecate-ognltool updated (740cb68e8 -> 35b0a6887)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5336-deprecate-ognltool in repository https://gitbox.apache.org/repos/asf/struts.git discard 740cb68e8 WW-5336 Switch to HashMap as concurrency handling not required discard 83c555af5 WW-5336 Reduce cognitive complexity #makeSelectList discard 9f4b84cca WW-5336 Deprecate OGNL in template context discard 79e950fe7 WW-5336 Clean up StrutsUtil add 12cd92cb6 WW-5336 Clean up StrutsUtil add 85e8d819e WW-5336 Deprecate OGNL in template context add 0f068d37a WW-5336 Reduce cognitive complexity #makeSelectList add 6b13e8ac3 WW-5336 Switch to HashMap as concurrency handling not required add 35b0a6887 WW-5336 Update JavaDoc VelocityManager This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (740cb68e8) \ N -- N -- N refs/heads/WW-5336-deprecate-ognltool (35b0a6887) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: .../java/org/apache/struts2/util/StrutsUtil.java | 7 ++-- .../org/apache/struts2/util/StrutsUtilTest.java| 42 ++ .../struts2/views/velocity/VelocityManager.java| 22 +++- 3 files changed, 44 insertions(+), 27 deletions(-)
[struts] branch fix/drops-duplicated-dependency created (now 947c6c8a6)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch fix/drops-duplicated-dependency in repository https://gitbox.apache.org/repos/asf/struts.git at 947c6c8a6 Drops duplicated dependency This branch includes the following new commits: new 947c6c8a6 Drops duplicated dependency The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[struts] 01/01: Drops duplicated dependency
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch fix/drops-duplicated-dependency in repository https://gitbox.apache.org/repos/asf/struts.git commit 947c6c8a6aaedb5d00ea8ed09773064679c1a895 Author: Lukasz Lenart AuthorDate: Tue Aug 22 07:46:43 2023 +0200 Drops duplicated dependency --- plugins/async/pom.xml | 7 --- 1 file changed, 7 deletions(-) diff --git a/plugins/async/pom.xml b/plugins/async/pom.xml index ae6eb7662..1b108c998 100644 --- a/plugins/async/pom.xml +++ b/plugins/async/pom.xml @@ -36,13 +36,6 @@ - -javax.servlet -javax.servlet-api -3.0.1 -provided - - mockobjects mockobjects-core
[struts] branch fix/drops-duplicated-dependency deleted (was 947c6c8a6)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch fix/drops-duplicated-dependency in repository https://gitbox.apache.org/repos/asf/struts.git was 947c6c8a6 Drops duplicated dependency The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[struts] branch master updated (e75f8d82b -> c087f2e64)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/struts.git from e75f8d82b Merge pull request #736 from apache/WW-5337-exclusion-performance add 947c6c8a6 Drops duplicated dependency add c087f2e64 Merge pull request #737 from apache/fix/drops-duplicated-dependency No new revisions were added by this update. Summary of changes: plugins/async/pom.xml | 7 --- 1 file changed, 7 deletions(-)
[struts] branch dependabot/maven/javax.servlet-javax.servlet-api-3.1.0 deleted (was 56d2ff6dd)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/javax.servlet-javax.servlet-api-3.1.0 in repository https://gitbox.apache.org/repos/asf/struts.git was 56d2ff6dd Bump javax.servlet:javax.servlet-api from 3.0.1 to 3.1.0 The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[struts] branch WW-5336-deprecate-ognltool updated (35b0a6887 -> 6e5a1a07f)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5336-deprecate-ognltool in repository https://gitbox.apache.org/repos/asf/struts.git from 35b0a6887 WW-5336 Update JavaDoc VelocityManager add 3b515b1a7 WW-5336 Fix visibility warnings add 215541146 WW-5336 Correct assertions and add test case add 6e5a1a07f WW-5336 Move XML comment to be clearer No new revisions were added by this update. Summary of changes: core/src/main/resources/struts-beans.xml | 3 +- .../org/apache/struts2/util/StrutsUtilTest.java| 63 +- 2 files changed, 40 insertions(+), 26 deletions(-)