[struts] branch WW-5021-static-content-path updated: WW-5021 Adds missing validation for trailing "/"

2021-01-07 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch WW-5021-static-content-path
in repository https://gitbox.apache.org/repos/asf/struts.git


The following commit(s) were added to refs/heads/WW-5021-static-content-path by 
this push:
 new 1f70627  WW-5021 Adds missing validation for trailing "/"
1f70627 is described below

commit 1f70627058d74cf9911e1c52234437bb866b2bdf
Author: Lukasz Lenart 
AuthorDate: Fri Jan 8 08:45:18 2021 +0100

WW-5021 Adds missing validation for trailing "/"
---
 .../struts2/dispatcher/StaticContentLoader.java|  7 ++-
 .../org/apache/struts2/default.properties  | 11 +-
 .../org/apache/struts2/components/UIBeanTest.java  |  5 +
 .../dispatcher/DefaultStaticContentLoaderTest.java | 24 +-
 4 files changed, 22 insertions(+), 25 deletions(-)

diff --git 
a/core/src/main/java/org/apache/struts2/dispatcher/StaticContentLoader.java 
b/core/src/main/java/org/apache/struts2/dispatcher/StaticContentLoader.java
index da2fd7a..f3a15e5 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/StaticContentLoader.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/StaticContentLoader.java
@@ -84,11 +84,16 @@ public interface StaticContentLoader {
 uiStaticContentPath,
 StaticContentLoader.DEFAULT_STATIC_CONTENT_PATH);
 return StaticContentLoader.DEFAULT_STATIC_CONTENT_PATH;
-} else if(!uiStaticContentPath.startsWith("/")) {
+} else if (!uiStaticContentPath.startsWith("/")) {
 LOG.warn("\"{}\" must start with \"/\", but has been set to 
\"{}\", prepending the missing \"/\"!",
 StrutsConstants.STRUTS_UI_STATIC_CONTENT_PATH,
 uiStaticContentPath);
 return "/" + uiStaticContentPath;
+} else if (uiStaticContentPath.endsWith("/")) {
+LOG.warn("\"{}\" must not end with \"/\", but has been set to 
\"{}\", removing all trailing \"/\"!",
+StrutsConstants.STRUTS_UI_STATIC_CONTENT_PATH,
+uiStaticContentPath);
+return StringUtils.stripEnd(uiStaticContentPath, "/");
 } else {
 LOG.debug("\"{}\" has been set to \"{}\"", 
StrutsConstants.STRUTS_UI_STATIC_CONTENT_PATH, uiStaticContentPath);
 return uiStaticContentPath;
diff --git a/core/src/main/resources/org/apache/struts2/default.properties 
b/core/src/main/resources/org/apache/struts2/default.properties
index 60819c6..95a2bd4 100644
--- a/core/src/main/resources/org/apache/struts2/default.properties
+++ b/core/src/main/resources/org/apache/struts2/default.properties
@@ -83,11 +83,15 @@ struts.multipart.maxSize=2097152
 ### prior to a comma e.g. struts.action.extension=, or 
struts.action.extension=x,y,z,,
 struts.action.extension=action,,
 
-### Used by FilterDispatcher
+### Used by Dispatcher
 ### If true then Struts serves static content from inside its jar.
-### If false then the static content must be available at /struts
+### If false then the static content must be available at /static
 struts.serve.static=true
 
+### A path from which a static content is served, it must start with "/"
+### and it cannot end with "/"
+struts.ui.staticContentPath=/static
+
 ### Used by FilterDispatcher
 ### This is good for development where one wants changes to the static content 
be
 ### fetch on each request.
@@ -147,9 +151,6 @@ struts.ui.theme.expansion.token=~~~
 #sets the default template type. Either ftl, vm, or jsp
 struts.ui.templateSuffix=ftl
 
-### A path from which a static content is served in case of tags
-struts.ui.staticContentPath=/static
-
 ### Configuration reloading
 ### This will cause the configuration to reload struts.xml when it is changed
 ### struts.configuration.xml.reload=false
diff --git a/core/src/test/java/org/apache/struts2/components/UIBeanTest.java 
b/core/src/test/java/org/apache/struts2/components/UIBeanTest.java
index 4eac690..e4b0c63 100644
--- a/core/src/test/java/org/apache/struts2/components/UIBeanTest.java
+++ b/core/src/test/java/org/apache/struts2/components/UIBeanTest.java
@@ -373,6 +373,11 @@ public class UIBeanTest extends StrutsInternalTestCase {
 field.setStaticContentPath("/content");
 // then
 assertEquals("/content", field.uiStaticContentPath);
+
+// when
+field.setStaticContentPath("/content/");
+// then
+assertEquals("/content", field.uiStaticContentPath);
 }
 
 }
diff --git 
a/core/src/test/java/org/apache/struts2/dispatcher/DefaultStaticContentLoaderTest.java
 
b/core/src/test/java/org/apache/struts2/dispatcher/DefaultStaticContentLoaderTest.java
index d712088..b472ce5 100644
--- 
a/core/src/test/java/org/apache/struts2/dispatcher/DefaultStaticContentLoaderTest.java
+++ 
b/core/src/test/java/org/apache/struts2/dispatcher/DefaultStaticContentLoaderTest.java
@@ -

[struts] branch WW-5000-constants updated: WW-5000 Drops duplicated test case

2021-01-07 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch WW-5000-constants
in repository https://gitbox.apache.org/repos/asf/struts.git


The following commit(s) were added to refs/heads/WW-5000-constants by this push:
 new 83838d1  WW-5000 Drops duplicated test case
83838d1 is described below

commit 83838d1b9ad89db157ab22c48ff31c4f239460f7
Author: Lukasz Lenart 
AuthorDate: Fri Jan 8 08:52:22 2021 +0100

WW-5000 Drops duplicated test case
---
 .../ognl/accessor/XWorkListPropertyAccessorTest.java  | 19 ---
 1 file changed, 19 deletions(-)

diff --git 
a/core/src/test/java/com/opensymphony/xwork2/ognl/accessor/XWorkListPropertyAccessorTest.java
 
b/core/src/test/java/com/opensymphony/xwork2/ognl/accessor/XWorkListPropertyAccessorTest.java
index df5ea4b..66c716c 100644
--- 
a/core/src/test/java/com/opensymphony/xwork2/ognl/accessor/XWorkListPropertyAccessorTest.java
+++ 
b/core/src/test/java/com/opensymphony/xwork2/ognl/accessor/XWorkListPropertyAccessorTest.java
@@ -83,23 +83,4 @@ public class XWorkListPropertyAccessorTest extends 
XWorkTestCase {
 assertEquals(3, vs.findValue("strings.size()"));
 }
 
-public void testDeprecatedAutoGrowCollectionLimit() {
-PropertyAccessor accessor = 
container.getInstance(PropertyAccessor.class, ArrayList.class.getName());
-((XWorkListPropertyAccessor) accessor).setAutoGrowCollectionLimit("2");
-
-List myList = new ArrayList<>();
-ListHolder listHolder = new ListHolder();
-listHolder.setStrings(myList);
-
-ValueStack vs = ActionContext.getContext().getValueStack();
-vs.push(listHolder);
-
-vs.setValue("strings[0]", "a");
-vs.setValue("strings[1]", "b");
-vs.setValue("strings[2]", "c");
-vs.setValue("strings[3]", "d");
-
-assertEquals(3, vs.findValue("strings.size()"));
-}
-
 }