(struts) branch fix/WW-5365-radio-value created (now 55ca7a5b3)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch fix/WW-5365-radio-value in repository https://gitbox.apache.org/repos/asf/struts.git at 55ca7a5b3 WW-5365 Reverts changes introduced in WW-5192 to allow evaluate the value attribute This branch includes the following new commits: new 55ca7a5b3 WW-5365 Reverts changes introduced in WW-5192 to allow evaluate the value attribute 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: WW-5365 Reverts changes introduced in WW-5192 to allow evaluate the value attribute
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch fix/WW-5365-radio-value in repository https://gitbox.apache.org/repos/asf/struts.git commit 55ca7a5b345b00898f43e7dd5af61ea9268beba0 Author: Lukasz Lenart AuthorDate: Sun Jan 7 11:37:10 2024 +0100 WW-5365 Reverts changes introduced in WW-5192 to allow evaluate the value attribute --- .../java/org/apache/struts2/components/Radio.java | 8 - .../test/java/org/apache/struts2/TestAction.java | 9 ++ .../org/apache/struts2/views/jsp/ui/RadioTest.java | 37 -- .../org/apache/struts2/views/jsp/ui/Radio-11.txt | 4 +++ 4 files changed, 48 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/org/apache/struts2/components/Radio.java b/core/src/main/java/org/apache/struts2/components/Radio.java index 7ef81000a..5c59e70ec 100644 --- a/core/src/main/java/org/apache/struts2/components/Radio.java +++ b/core/src/main/java/org/apache/struts2/components/Radio.java @@ -66,10 +66,6 @@ public class Radio extends ListUIBean { return TEMPLATE; } -public void evaluateExtraParams() { - super.evaluateExtraParams(); -} - /** * Radio tag requires lazy evaluation as list of tags is dynamically generated using * @@ -80,8 +76,4 @@ public class Radio extends ListUIBean { return true; } -protected Class getValueClassType() { -return String.class; -} - } diff --git a/core/src/test/java/org/apache/struts2/TestAction.java b/core/src/test/java/org/apache/struts2/TestAction.java index 5543b4462..77f784a61 100644 --- a/core/src/test/java/org/apache/struts2/TestAction.java +++ b/core/src/test/java/org/apache/struts2/TestAction.java @@ -53,6 +53,7 @@ public class TestAction extends ActionSupport { private Long id; private List enumList; private List intList; +private Boolean someBool; private final Map texts = new HashMap<>(); @@ -254,4 +255,12 @@ public class TestAction extends ActionSupport { public void setIntList(List intList) { this.intList = intList; } + +public Boolean getSomeBool() { +return someBool; +} + +public void setSomeBool(Boolean someBool) { +this.someBool = someBool; +} } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java index 72e4cbf06..47a5caad7 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java @@ -64,6 +64,37 @@ public class RadioTest extends AbstractUITagTest { strutsBodyTagsAreReflectionEqual(tag, freshTag)); } +public void testMapWithBooleanAsKeyWithoutForceValue() throws Exception { +TestAction testAction = (TestAction) action; + +Map map = new LinkedHashMap<>(); +map.put(Boolean.TRUE, "male"); +map.put(Boolean.FALSE, "female"); +testAction.setMap(map); + +testAction.setSomeBool(false); + +RadioTag tag = new RadioTag(); +tag.setPageContext(pageContext); +tag.setLabel("mylabel"); +tag.setName("myname"); +tag.setValue("someBool"); +tag.setList("map"); +tag.setTheme("simple"); + +tag.doStartTag(); +tag.doEndTag(); + +verify(RadioTag.class.getResource("Radio-11.txt")); + +// Basic sanity check of clearTagStateForTagPoolingServers() behaviour for Struts Tags after doEndTag(). +RadioTag freshTag = new RadioTag(); +freshTag.setPageContext(pageContext); +assertFalse("Tag state after doEndTag() under default tag clear state is equal to new Tag with pageContext/parent set. " + +"May indicate that clearTagStateForTagPoolingServers() calls are not working properly.", +strutsBodyTagsAreReflectionEqual(tag, freshTag)); +} + public void testMapWithBooleanAsKey_clearTagStateSet() throws Exception { TestAction testAction = (TestAction) action; @@ -165,12 +196,13 @@ public class RadioTest extends AbstractUITagTest { List enumList = new ArrayList<>(Arrays.asList(SomeEnum.values())); testAction.setEnumList(enumList); +testAction.setStatus(SomeEnum.INIT); RadioTag tag = new RadioTag(); tag.setTheme("simple"); tag.setPageContext(pageContext); tag.setName("status"); -tag.setValue("INIT"); +tag.setValue("status"); tag.setList("enumList"); tag.doStartTag(); @@ -191,13 +223,14 @@ public class RadioTest extends AbstractUITagTest { List enumList = new ArrayList<>(Arrays.asList(SomeEnum.values())); testAction.setEnumList(enumList); +testAction.setStatus(SomeEnum.INIT); RadioTag tag = new RadioTag(); tag.setPerformClearTagStateForTagPoolingServers(true);
(struts) branch dependabot/maven/log4j2.version-2.22.1 created (now c8f5ba134)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/log4j2.version-2.22.1 in repository https://gitbox.apache.org/repos/asf/struts.git at c8f5ba134 Bump log4j2.version from 2.20.0 to 2.22.1 No new revisions were added by this update.
(struts) branch dependabot/maven/org.apache.maven.plugins-maven-release-plugin-3.0.1 created (now b9d072d18)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/org.apache.maven.plugins-maven-release-plugin-3.0.1 in repository https://gitbox.apache.org/repos/asf/struts.git at b9d072d18 Bump org.apache.maven.plugins:maven-release-plugin No new revisions were added by this update.
(struts) branch master updated (ecd02de8b -> 07cecbf63)
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 ecd02de8b Merge pull request #831 from apache/WW-5352-parameter-annotation-2 add b9d072d18 Bump org.apache.maven.plugins:maven-release-plugin add 07cecbf63 Merge pull request #837 from apache/dependabot/maven/org.apache.maven.plugins-maven-release-plugin-3.0.1 No new revisions were added by this update. Summary of changes: pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
(struts) branch dependabot/maven/org.apache.maven.plugins-maven-release-plugin-3.0.1 deleted (was b9d072d18)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch dependabot/maven/org.apache.maven.plugins-maven-release-plugin-3.0.1 in repository https://gitbox.apache.org/repos/asf/struts.git was b9d072d18 Bump org.apache.maven.plugins:maven-release-plugin 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 fix/debug-level created (now 5b020eb57)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch fix/debug-level in repository https://gitbox.apache.org/repos/asf/struts.git at 5b020eb57 Reduces log level to debug to reduce noise in the logs This branch includes the following new commits: new 5b020eb57 Reduces log level to debug to reduce noise in the logs 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: Reduces log level to debug to reduce noise in the logs
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch fix/debug-level in repository https://gitbox.apache.org/repos/asf/struts.git commit 5b020eb570efb91cc345973b277ac0affec86871 Author: Lukasz Lenart AuthorDate: Mon Jan 8 07:11:35 2024 +0100 Reduces log level to debug to reduce noise in the logs --- .../java/com/opensymphony/xwork2/ognl/OgnlValueStackFactory.java| 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStackFactory.java b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStackFactory.java index f72ad4be8..2910d40a6 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStackFactory.java +++ b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStackFactory.java @@ -132,7 +132,7 @@ public class OgnlValueStackFactory implements ValueStackFactory { } MethodAccessor methodAccessor = container.getInstance(MethodAccessor.class, name); OgnlRuntime.setMethodAccessor(cls, methodAccessor); -LOG.info("Registered custom OGNL MethodAccessor [{}] for class [{}]", methodAccessor.getClass().getName(), cls.getName()); +LOG.debug("Registered custom OGNL MethodAccessor [{}] for class [{}]", methodAccessor.getClass().getName(), cls.getName()); } } @@ -142,7 +142,7 @@ public class OgnlValueStackFactory implements ValueStackFactory { Class cls = Class.forName(name); NullHandler nullHandler = container.getInstance(NullHandler.class, name); OgnlRuntime.setNullHandler(cls, new OgnlNullHandlerWrapper(nullHandler)); -LOG.info("Registered custom OGNL NullHandler [{}] for class [{}]", nullHandler.getClass().getName(), cls.getName()); +LOG.debug("Registered custom OGNL NullHandler [{}] for class [{}]", nullHandler.getClass().getName(), cls.getName()); } } @@ -156,7 +156,7 @@ public class OgnlValueStackFactory implements ValueStackFactory { } PropertyAccessor propertyAccessor = container.getInstance(PropertyAccessor.class, name); OgnlRuntime.setPropertyAccessor(cls, propertyAccessor); -LOG.info("Registered custom OGNL PropertyAccessor [{}] for class [{}]", propertyAccessor.getClass().getName(), cls.getName()); +LOG.debug("Registered custom OGNL PropertyAccessor [{}] for class [{}]", propertyAccessor.getClass().getName(), cls.getName()); } }
(struts) branch WW-5385-strutsvelocitycontext created (now 215a5fc31)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5385-strutsvelocitycontext in repository https://gitbox.apache.org/repos/asf/struts.git at 215a5fc31 WW-5385 Decompose StrutsVelocityContext for better re-usability This branch includes the following new commits: new 215a5fc31 WW-5385 Decompose StrutsVelocityContext for better re-usability 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: WW-5385 Decompose StrutsVelocityContext for better re-usability
This is an automated email from the ASF dual-hosted git repository. kusal pushed a commit to branch WW-5385-strutsvelocitycontext in repository https://gitbox.apache.org/repos/asf/struts.git commit 215a5fc31569c7eeb37186dbdce020c8ac8a275d Author: Kusal Kithul-Godage AuthorDate: Mon Jan 8 18:17:11 2024 +1100 WW-5385 Decompose StrutsVelocityContext for better re-usability --- .../views/velocity/ChainedVelocityContext.java | 28 .../struts2/views/velocity/CompositeContext.java | 70 ++ .../views/velocity/DirectiveVelocityContext.java | 26 +++ .../views/velocity/StrutsVelocityContext.java | 83 ++ .../struts2/views/velocity/VelocityManager.java| 2 +- .../views/velocity/CompositeContextTest.java | 52 ++ .../views/velocity/StrutsVelocityContextTest.java | 17 +++-- 7 files changed, 208 insertions(+), 70 deletions(-) diff --git a/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/ChainedVelocityContext.java b/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/ChainedVelocityContext.java new file mode 100644 index 0..d9efaa0c4 --- /dev/null +++ b/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/ChainedVelocityContext.java @@ -0,0 +1,28 @@ +package org.apache.struts2.views.velocity; + +import org.apache.velocity.VelocityContext; +import org.apache.velocity.context.Context; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * Extends the default {@link VelocityContext} to ensure that the {@link #getKeys()} method returns all keys from the + * current context and the chained context. + */ +public class ChainedVelocityContext extends VelocityContext { + +public ChainedVelocityContext(Context delegate) { +super(delegate); +} + +@Override +public String[] getKeys() { +Set allKeys = new HashSet<>(Arrays.asList(internalGetKeys())); +if (getChainedContext() != null) { +allKeys.addAll(Arrays.asList(getChainedContext().getKeys())); +} +return allKeys.toArray(new String[0]); +} +} diff --git a/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/CompositeContext.java b/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/CompositeContext.java new file mode 100644 index 0..27797cb48 --- /dev/null +++ b/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/CompositeContext.java @@ -0,0 +1,70 @@ +package org.apache.struts2.views.velocity; + +import org.apache.velocity.VelocityContext; +import org.apache.velocity.context.Context; + +import java.util.Arrays; +import java.util.stream.StreamSupport; + +import static java.util.Objects.requireNonNull; + +/** + * Simple immutable composite Velocity {@link Context} implementation that delegates to a collection of other contexts. + * The order of the contexts is significant as it checks them in iteration order. This context should be wrapped in a + * {@link org.apache.velocity.VelocityContext} or other chained context before use, using the provided static factory + * methods or otherwise. + */ +public class CompositeContext implements Context { +private final Iterable contexts; + +public static VelocityContext composite(Iterable contexts) { +return new ChainedVelocityContext(new CompositeContext(contexts)); +} + +public static VelocityContext composite(Context... contexts) { +return new ChainedVelocityContext(new CompositeContext(contexts)); +} + +public CompositeContext(Context... contexts) { +this(Arrays.asList(contexts)); +} + +public CompositeContext(Iterable contexts) { +this.contexts = requireNonNull(contexts); +} + +@Override +public Object get(String key) { +for (Context context : contexts) { +Object value = context.get(key); +if (value != null) { +return value; +} +} +return null; +} + +@Override +public boolean containsKey(String key) { +return StreamSupport.stream(contexts.spliterator(), false).anyMatch(context -> context.containsKey(key)); +} + +/** + * Union of all keys for all contexts. + */ +@Override +public String[] getKeys() { +return StreamSupport.stream(contexts.spliterator(), false) + .map(Context::getKeys).flatMap(Arrays::stream).distinct().toArray(String[]::new); +} + +@Override +public Object remove(String key) { +throw new UnsupportedOperationException(); +} + +@Override +public Object put(String key, Object value) { +throw new UnsupportedOperationException(); +} +} diff --git a/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/DirectiveVelocityContext.java b/plugins/velocity/src/main/java/org/apache/struts2/views/velocity/DirectiveVelocityContext.java new file mode 100644 ind
(struts) branch fix/debug-level deleted (was 5b020eb57)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch fix/debug-level in repository https://gitbox.apache.org/repos/asf/struts.git was 5b020eb57 Reduces log level to debug to reduce noise in the logs 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) 01/01: Merge pull request #838 from apache/fix/debug-level
This is an automated email from the ASF dual-hosted git repository. kusal pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/struts.git commit f5a7c31f2556a5ac721bc8aa59ad7870c65e8456 Merge: 07cecbf63 5b020eb57 Author: Kusal Kithul-Godage AuthorDate: Mon Jan 8 18:21:18 2024 +1100 Merge pull request #838 from apache/fix/debug-level Reduces log level to debug to reduce noise in the logs .../java/com/opensymphony/xwork2/ognl/OgnlValueStackFactory.java| 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
(struts) branch master updated (07cecbf63 -> f5a7c31f2)
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 07cecbf63 Merge pull request #837 from apache/dependabot/maven/org.apache.maven.plugins-maven-release-plugin-3.0.1 add 5b020eb57 Reduces log level to debug to reduce noise in the logs new f5a7c31f2 Merge pull request #838 from apache/fix/debug-level 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: .../java/com/opensymphony/xwork2/ognl/OgnlValueStackFactory.java| 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
(struts) branch WW-5385-strutsvelocitycontext updated (215a5fc31 -> f8d6769ac)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5385-strutsvelocitycontext in repository https://gitbox.apache.org/repos/asf/struts.git discard 215a5fc31 WW-5385 Decompose StrutsVelocityContext for better re-usability add 5b020eb57 Reduces log level to debug to reduce noise in the logs add f5a7c31f2 Merge pull request #838 from apache/fix/debug-level add f8d6769ac WW-5385 Decompose StrutsVelocityContext for better re-usability 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 (215a5fc31) \ N -- N -- N refs/heads/WW-5385-strutsvelocitycontext (f8d6769ac) 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: .../xwork2/ognl/OgnlValueStackFactory.java | 6 +++--- .../struts2/views/velocity/ChainedVelocityContext.java | 18 ++ .../struts2/views/velocity/CompositeContext.java | 18 ++ .../views/velocity/DirectiveVelocityContext.java | 18 ++ .../struts2/views/velocity/CompositeContextTest.java | 18 ++ 5 files changed, 75 insertions(+), 3 deletions(-)
(struts) branch WW-5385-strutsvelocitycontext updated (f8d6769ac -> 9bc79781f)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5385-strutsvelocitycontext in repository https://gitbox.apache.org/repos/asf/struts.git discard f8d6769ac WW-5385 Decompose StrutsVelocityContext for better re-usability add 9bc79781f WW-5385 Decompose StrutsVelocityContext for better re-usability 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 (f8d6769ac) \ N -- N -- N refs/heads/WW-5385-strutsvelocitycontext (9bc79781f) 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: .../org/apache/struts2/views/velocity/DirectiveVelocityContext.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
(struts) branch WW-5385-strutsvelocitycontext updated (9bc79781f -> 3916085b9)
This is an automated email from the ASF dual-hosted git repository. kusal pushed a change to branch WW-5385-strutsvelocitycontext in repository https://gitbox.apache.org/repos/asf/struts.git discard 9bc79781f WW-5385 Decompose StrutsVelocityContext for better re-usability add 3916085b9 WW-5385 Decompose StrutsVelocityContext for better re-usability 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 (9bc79781f) \ N -- N -- N refs/heads/WW-5385-strutsvelocitycontext (3916085b9) 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/ChainedVelocityContext.java | 2 ++ .../main/java/org/apache/struts2/views/velocity/CompositeContext.java | 2 ++ 2 files changed, 4 insertions(+)