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 2024/01/27 13:43:35 UTC

(struts) branch fix/WW-5360-iterator updated (d258029cf -> a358db585)

This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch fix/WW-5360-iterator
in repository https://gitbox.apache.org/repos/asf/struts.git


    omit d258029cf WW-5360 Introduces additional countStr & indexStr to allow to ignore conversion
     add 775febbdf Upgrade maven to 3.9.6 and wrapper to 3.2.0
     add 1e56b7ce6 Merge pull request #853 from sepe81/feature/upgrade-maven-to-3.9.6
     add cde86457a Bump actions/upload-artifact from 4.1.0 to 4.2.0
     add ec18f0eef Merge pull request #855 from apache/dependabot/github_actions/actions/upload-artifact-4.2.0
     add cf74a4450 Fixes excluding Plexus container in OWASP scan
     add 65c0427ea Merge pull request #858 from apache/fix/plexus-exclusion
     add 9f4b67a9a Drops JDK11 build and fixes duplicated steps
     add 2de30e72a Merge pull request #859 from apache/fix/sped-up-build
     add e7a13b963 Small spelling and MD fixes (IntelliJ assisted)
     add 644bd1f8c Mention just the maintenance branches for supported versions
     add 7843cd5e1 Merge pull request #854 from sepe81/feature/update-security-policy
     add 2513fcb29 Stops running sonar.yml on forks
     add 5057aeac8 Merge pull request #862 from apache/lukaszlenart-patch-1
     add eca0666f0 WW-5352 Introduce StrutsParameter annotation
     add ad576f0fd WW-5352 Introduce ThreadAllowlist bean
     add 4255da3ee WW-5352 First draft implementation
     add bf3f407b5 WW-5352 Ensure allowlist is cleared if in unexpected state
     add 4c5f2b026 WW-5352 Add full unit test coverage
     add e9154b922 Merge branch 'master' into WW-5352-parameter-annotation-3
     add 5d7930123 WW-5352 Fix missing curved bracket
     add 4c60f39c7 WW-5352 Enable annotations for showcase
     add b2c754226 WW-5352 Dispatcher should up thread allowlist
     add a57c2882e WW-5352 Reinstate manual allowlist for generic types
     add 0a71e2c3b WW-5352 Implement auto-allowlisting for Iterator component
     add 770d31110 WW-5352 Mild optimisation
     add 6df80041e WW-5352 Auto allowlist parameterized types!
     add f106b2098 WW-5352 Map-like type support
     add bf7737fa0 WW-5352 Add unit test coverage for generics
     add 56d8361b4 WW-5352 Implement transition mode
     add 49b9c0c78 WW-5352 Ensure superclasses and interfaces allowlisted
     add 728d695ce WW-5352 Add debug logging for parameter rejections
     add b50616942 WW-5352 Acceptance test coverage
     add 71d77df3f WW-5352 Normalise parameter name
     add bd783a0e1 Merge pull request #832 from apache/WW-5352-parameter-annotation-3
     new a358db585 WW-5360 Introduces additional countStr & indexStr to allow to ignore conversion

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   (d258029cf)
            \
             N -- N -- N   refs/heads/fix/WW-5360-iterator (a358db585)

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.

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:
 .github/workflows/scorecards-analysis.yaml         |   2 +-
 .github/workflows/sonar.yml                        |   1 +
 .mvn/wrapper/MavenWrapperDownloader.java           | 117 -------
 .mvn/wrapper/maven-wrapper.properties              |   8 +-
 Jenkinsfile                                        |  62 +---
 SECURITY.md                                        |  12 +-
 .../org/apache/struts2/showcase/UITagExample.java  |  24 +-
 .../showcase/action/ParamsAnnotationAction.java    | 133 ++++++++
 .../struts2/showcase/action/SkillAction.java       |   2 +
 .../struts2/showcase/async/ChatRoomAction.java     |   3 +
 .../struts2/showcase/conversion/AddressAction.java |   4 +-
 .../showcase/conversion/OperationsEnumAction.java  |   2 +
 .../struts2/showcase/conversion/PersonAction.java  |   2 +
 .../showcase/filedownload/FileDownloadAction.java  |   2 +
 .../showcase/fileupload/FileUploadAction.java      |   2 +
 .../org/apache/struts2/showcase/model/MyDto.java   |  23 +-
 .../validation/FieldValidatorsExampleAction.java   |  11 +
 .../struts2/showcase/wait/LongProcessAction.java   |   2 +
 .../main/resources/struts-params-annotation.xml    |  10 +-
 apps/showcase/src/main/resources/struts.xml        |  14 +-
 .../src/main/webapp/WEB-INF/paramsannotation.vm    |   8 +-
 .../struts2/showcase/StrutsParametersTest.java     | 239 ++++++++++++++
 .../xwork2/config/impl/DefaultConfiguration.java   |   2 +
 .../xwork2/ognl/SecurityMemberAccess.java          |  10 +-
 .../security/DefaultAcceptedPatternsChecker.java   |  18 +-
 .../java/org/apache/struts2/StrutsConstants.java   |   3 +
 .../struts2/components/IteratorComponent.java      |  13 +-
 .../org/apache/struts2/dispatcher/Dispatcher.java  |   8 +
 .../parameter/ParametersInterceptor.java           | 204 +++++++++++-
 .../interceptor/parameter/StrutsParameter.java     |  96 +++---
 .../apache/struts2/ognl/ThreadAllowlist.java}      |  48 ++-
 .../struts2/views/jsp/ComponentTagSupport.java     |  19 +-
 core/src/main/resources/struts-beans.xml           |   1 +
 .../xwork2/ognl/SecurityMemberAccessTest.java      |   6 +-
 .../struts2/components/IteratorComponentTest.java  |  29 +-
 .../parameter/StrutsParameterAnnotationTest.java   | 348 +++++++++++++++++++++
 mvnw                                               | 218 +++++++------
 mvnw.cmd                                           |  31 +-
 pom.xml                                            |   7 +-
 src/etc/project-suppression.xml                    |  21 +-
 40 files changed, 1292 insertions(+), 473 deletions(-)
 delete mode 100644 .mvn/wrapper/MavenWrapperDownloader.java
 create mode 100644 apps/showcase/src/main/java/org/apache/struts2/showcase/action/ParamsAnnotationAction.java
 copy core/src/main/java/com/opensymphony/xwork2/conversion/annotations/ConversionType.java => apps/showcase/src/main/java/org/apache/struts2/showcase/model/MyDto.java (67%)
 copy plugins/xslt/src/main/resources/struts-plugin.xml => apps/showcase/src/main/resources/struts-params-annotation.xml (78%)
 copy plugins/embeddedjsp/src/test/resources/org/apache/struts2/dont-use.jsp => apps/showcase/src/main/webapp/WEB-INF/paramsannotation.vm (93%)
 create mode 100644 apps/showcase/src/test/java/it/org/apache/struts2/showcase/StrutsParametersTest.java
 copy plugins/convention/src/main/java/org/apache/struts2/convention/annotation/ExceptionMapping.java => core/src/main/java/org/apache/struts2/interceptor/parameter/StrutsParameter.java (57%)
 copy core/src/main/java/{com/opensymphony/xwork2/mock/MockContainer.java => org/apache/struts2/ognl/ThreadAllowlist.java} (50%)
 create mode 100644 core/src/test/java/org/apache/struts2/interceptor/parameter/StrutsParameterAnnotationTest.java


(struts) 01/01: WW-5360 Introduces additional countStr & indexStr to allow to ignore conversion

Posted by lu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a358db585326e6e1cddd5442b0f3e1fec0d01ed7
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Sun Jan 21 10:39:49 2024 +0100

    WW-5360 Introduces additional countStr & indexStr to allow to ignore conversion
---
 .../apache/struts2/views/jsp/IteratorStatus.java   |  20 +-
 .../java/com/opensymphony/xwork2/test/User.java    |   6 +
 .../test/java/org/apache/struts2/TestAction.java   |   9 +
 .../struts2/components/IteratorComponentTest.java  | 192 ++++++++++++++++++-
 .../apache/struts2/views/jsp/IteratorTagTest.java  | 205 ++++++++++-----------
 5 files changed, 314 insertions(+), 118 deletions(-)

diff --git a/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java b/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java
index 13022f856..fedef363e 100644
--- a/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java
+++ b/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java
@@ -26,23 +26,29 @@ package org.apache.struts2.views.jsp;
  * <li>count: iterations so far, starts on 1. count is always index + 1</li>
  * <li>first: true if index == 0</li>
  * <li>even: true if (index + 1) % 2 == 0</li>
- * <li>last: true if current iteration is the last iteration</li> 
+ * <li>last: true if current iteration is the last iteration</li>
  * <li>odd: true if (index + 1) % 2 == 1</li>
  * </ul>
  * <p>Example</p>
  * <pre>
  *   &lt;s:iterator status="status" value='{0, 1}'&gt;
  *      Index: &lt;s:property value="%{#status.index}" /&gt; &lt;br /&gt;
- *      Count: &lt;s:property value="%{#status.count}" /&gt; &lt;br /&gt;  
+ *      Index Str: &lt;s:property value="%{#status.indexStr}" /&gt; &lt;br /&gt;
+ *      Count: &lt;s:property value="%{#status.count}" /&gt; &lt;br /&gt;
+ *      Count Str: &lt;s:property value="%{#status.countStr}" /&gt; &lt;br /&gt;
  *   &lt;/s:iterator&gt;
  * </pre>
- * 
+ *
  * <p>will print</p>
  * <pre>
  *      Index: 0
+ *      Index Str: 0
  *      Count: 1
+ *      Count Str: 1
  *      Index: 1
+ *      Index Str: 1
  *      Count: 2
+ *      Count Str: 2
  * </pre>
  */
 public class IteratorStatus {
@@ -56,6 +62,10 @@ public class IteratorStatus {
         return state.index + 1;
     }
 
+    public String getCountStr() {
+        return String.valueOf(state.index + 1);
+    }
+
     public boolean isEven() {
         return ((state.index + 1) % 2) == 0;
     }
@@ -68,6 +78,10 @@ public class IteratorStatus {
         return state.index;
     }
 
+    public String getIndexStr() {
+        return String.valueOf(state.index);
+    }
+
     public boolean isLast() {
         return state.last;
     }
diff --git a/core/src/test/java/com/opensymphony/xwork2/test/User.java b/core/src/test/java/com/opensymphony/xwork2/test/User.java
index d377fe018..e6c5d2af4 100644
--- a/core/src/test/java/com/opensymphony/xwork2/test/User.java
+++ b/core/src/test/java/com/opensymphony/xwork2/test/User.java
@@ -37,6 +37,12 @@ public class User implements UserMarker {
     private String email2;
     private String name;
 
+    public User() {
+    }
+
+    public User(String name) {
+        this.name = name;
+    }
 
     public void setCollection(Collection collection) {
         this.collection = collection;
diff --git a/core/src/test/java/org/apache/struts2/TestAction.java b/core/src/test/java/org/apache/struts2/TestAction.java
index 77f784a61..b9595de11 100644
--- a/core/src/test/java/org/apache/struts2/TestAction.java
+++ b/core/src/test/java/org/apache/struts2/TestAction.java
@@ -45,6 +45,7 @@ public class TestAction extends ActionSupport {
     private String result;
     private User user;
     private String[] array;
+    private Object[] objectArray;
     private String[][] list;
     private List list2;
     private List list3;
@@ -135,6 +136,14 @@ public class TestAction extends ActionSupport {
         this.array = array;
     }
 
+    public Object[] getObjectArray() {
+        return objectArray;
+    }
+
+    public void setObjectArray(Object[] arrayObject) {
+        this.objectArray = arrayObject;
+    }
+
     public String[][] getList() {
         return list;
     }
diff --git a/core/src/test/java/org/apache/struts2/components/IteratorComponentTest.java b/core/src/test/java/org/apache/struts2/components/IteratorComponentTest.java
index 065a42ae9..7f08ef64e 100644
--- a/core/src/test/java/org/apache/struts2/components/IteratorComponentTest.java
+++ b/core/src/test/java/org/apache/struts2/components/IteratorComponentTest.java
@@ -19,26 +19,29 @@
 package org.apache.struts2.components;
 
 import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.test.User;
 import com.opensymphony.xwork2.util.ValueStack;
 import org.apache.struts2.StrutsInternalTestCase;
 import org.apache.struts2.ognl.ThreadAllowlist;
+import org.apache.struts2.TestAction;
 
 import java.io.StringWriter;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Locale;
 
 public class IteratorComponentTest extends StrutsInternalTestCase {
 
     private ValueStack stack;
     private IteratorComponent ic;
-    private ThreadAllowlist threadAllowlist;
 
     @Override
     public void setUp() throws Exception {
         super.setUp();
         stack = ActionContext.getContext().getValueStack();
         ic = new IteratorComponent(stack);
-        threadAllowlist = new ThreadAllowlist();
+        ThreadAllowlist threadAllowlist = new ThreadAllowlist();
         ic.setThreadAllowlist(threadAllowlist);
     }
 
@@ -74,7 +77,48 @@ public class IteratorComponentTest extends StrutsInternalTestCase {
         assertEquals("item1 item2 item3 item4 ", out.getBuffer().toString());
     }
 
-    public void testIteratorWithBegin() throws Exception {
+    public void testSimpleIterator() {
+        // given
+        stack.push(new FooAction());
+
+        StringWriter out = new StringWriter();
+
+        ic.setBegin("1");
+        ic.setEnd("8");
+        ic.setStep("2");
+        ic.setStatus("status");
+
+        Property prop = new Property(stack);
+        Property status = new Property(stack);
+        status.setValue("#status.index");
+
+        ic.getComponentStack().push(prop);
+        ic.getComponentStack().push(status);
+        ic.getComponentStack().push(prop);
+        ic.getComponentStack().push(status);
+        ic.getComponentStack().push(prop);
+        ic.getComponentStack().push(status);
+        ic.getComponentStack().push(prop);
+        ic.getComponentStack().push(status);
+
+        String body = " ";
+
+        // when
+        assertTrue(ic.start(out));
+
+        for (int i = 0; i < 4; i++) {
+            status.start(out);
+            status.end(out, body);
+            prop.start(out);
+            prop.end(out, body);
+            ic.end(out, null);
+        }
+
+        // then
+        assertEquals("0 1 1 3 2 5 3 7 ", out.getBuffer().toString());
+    }
+
+    public void testIteratorWithBegin() {
         // given
         stack.push(new FooAction());
 
@@ -104,12 +148,12 @@ public class IteratorComponentTest extends StrutsInternalTestCase {
         assertEquals("item2 item3 item4 ", out.getBuffer().toString());
     }
 
-    public void testIteratorWithNulls() throws Exception {
+    public void testIteratorWithNulls() {
         // given
         stack.push(new FooAction() {
-            private List items  = Arrays.asList("1", "2", null, "4");
+            private final List<String> items = Arrays.asList("1", "2", null, "4");
 
-            public List getItems() {
+            public List<String> getItems() {
                 return items;
             }
         });
@@ -140,15 +184,147 @@ public class IteratorComponentTest extends StrutsInternalTestCase {
         assertEquals("1, 2, , 4, ", out.getBuffer().toString());
     }
 
+    public void testIteratorWithDifferentLocale() {
+        // given
+        ActionContext.getContext().withLocale(new Locale("fa_IR"));
+        stack.push(new FooAction());
+
+        StringWriter out = new StringWriter();
+
+        ic.setBegin("1");
+        ic.setEnd("3");
+        ic.setStatus("status");
+
+        Property prop = new Property(stack);
+        Property status = new Property(stack);
+        status.setValue("#status.count");
+
+        ic.getComponentStack().push(prop);
+        ic.getComponentStack().push(status);
+        ic.getComponentStack().push(prop);
+        ic.getComponentStack().push(status);
+        ic.getComponentStack().push(prop);
+        ic.getComponentStack().push(status);
+
+        String body = ",";
+
+        // when
+        assertTrue(ic.start(out));
+
+        for (int i = 0; i < 3; i++) {
+            status.start(out);
+            status.end(out, body);
+
+            prop.start(out);
+            prop.end(out, body);
+            ic.end(out, null);
+        }
+
+        // then
+        assertEquals("1,1,2,2,3,3,", out.getBuffer().toString());
+    }
+
+    public void testListOfBeansIterator() {
+        // given
+        TestAction action = new TestAction();
+        action.setList2(new ArrayList<User>() {{
+            add(new User("Anton"));
+            add(new User("Tym"));
+            add(new User("Luk"));
+        }});
+        stack.push(action);
+
+        StringWriter out = new StringWriter();
+
+        ic.setValue("list2");
+        ic.setStatus("status");
+
+        Property prop = new Property(stack);
+        prop.setValue("name");
+        Property status = new Property(stack);
+        status.setValue("#status.indexStr");
+
+        ic.getComponentStack().push(status);
+        ic.getComponentStack().push(prop);
+        ic.getComponentStack().push(status);
+        ic.getComponentStack().push(prop);
+        ic.getComponentStack().push(status);
+        ic.getComponentStack().push(prop);
+
+        String body = ",";
+
+        // when
+        assertTrue(ic.start(out));
+
+        for (int i = 0; i < 3; i++) {
+            status.start(out);
+            status.end(out, body);
+
+            prop.start(out);
+            prop.end(out, body);
+
+            ic.end(out, null);
+        }
+
+        // then
+        assertEquals("0,Anton,1,Tym,2,Luk,", out.getBuffer().toString());
+    }
+
+    public void testArrayOfBeansIterator() {
+        // given
+        TestAction action = new TestAction();
+        action.setObjectArray(new ArrayList<User>() {{
+            add(new User("Anton"));
+            add(new User("Tym"));
+            add(new User("Luk"));
+        }}.toArray());
+        stack.push(action);
+
+        StringWriter out = new StringWriter();
+
+        ic.setValue("objectArray");
+        ic.setStatus("status");
+
+        Property prop = new Property(stack);
+        prop.setValue("name");
+        Property status = new Property(stack);
+        status.setValue("#status.countStr");
+
+        ic.getComponentStack().push(status);
+        ic.getComponentStack().push(prop);
+        ic.getComponentStack().push(status);
+        ic.getComponentStack().push(prop);
+        ic.getComponentStack().push(status);
+        ic.getComponentStack().push(prop);
+
+        String body = " ";
+
+        // when
+        assertTrue(ic.start(out));
+
+        for (int i = 0; i < 3; i++) {
+            status.start(out);
+            status.end(out, body);
+
+            prop.start(out);
+            prop.end(out, body);
+
+            ic.end(out, null);
+        }
+
+        // then
+        assertEquals("1 Anton 2 Tym 3 Luk ", out.getBuffer().toString());
+    }
+
     static class FooAction {
 
-        private List items;
+        private final List<String> items;
 
         public FooAction() {
             items = Arrays.asList("item1", "item2", "item3", "item4");
         }
 
-        public List getItems() {
+        public List<String> getItems() {
             return items;
         }
     }
diff --git a/core/src/test/java/org/apache/struts2/views/jsp/IteratorTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/IteratorTagTest.java
index df5022c0a..fd3fc9587 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/IteratorTagTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/IteratorTagTest.java
@@ -20,6 +20,7 @@ package org.apache.struts2.views.jsp;
 
 import com.mockobjects.servlet.MockBodyContent;
 import com.mockobjects.servlet.MockJspWriter;
+import com.opensymphony.xwork2.ActionContext;
 import org.apache.commons.collections.ListUtils;
 
 import javax.servlet.jsp.JspException;
@@ -29,20 +30,15 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
-
-/**
- * Test Case for Iterator Tag
- *
- */
 public class IteratorTagTest extends AbstractUITagTest {
 
-    IteratorTag tag;
-
+    private IteratorTag tag;
 
     public void testIteratingWithIdSpecified() throws Exception {
-        List list = new ArrayList();
+        List<String> list = new ArrayList<>();
         list.add("one");
         list.add("two");
         list.add("three");
@@ -104,12 +100,12 @@ public class IteratorTagTest extends AbstractUITagTest {
         IteratorTag freshTag = new IteratorTag();
         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.",
+                        "May indicate that clearTagStateForTagPoolingServers() calls are not working properly.",
                 strutsBodyTagsAreReflectionEqual(tag, freshTag));
     }
 
     public void testIteratingWithIdSpecified_clearTagStateSet() throws Exception {
-        List list = new ArrayList();
+        List<String> list = new ArrayList<>();
         list.add("one");
         list.add("two");
         list.add("three");
@@ -174,12 +170,12 @@ public class IteratorTagTest extends AbstractUITagTest {
         freshTag.setPerformClearTagStateForTagPoolingServers(true);
         freshTag.setPageContext(pageContext);
         assertTrue("Tag state after doEndTag() and explicit tag state clearing is inequal to new Tag with pageContext/parent set.  " +
-                "May indicate that clearTagStateForTagPoolingServers() calls are not working properly.",
+                        "May indicate that clearTagStateForTagPoolingServers() calls are not working properly.",
                 strutsBodyTagsAreReflectionEqual(tag, freshTag));
     }
 
     public void testIteratingWithIdSpecifiedAndNullElementOnCollection() throws Exception {
-        List list = new ArrayList();
+        List<String> list = new ArrayList<>();
         list.add("one");
         list.add(null);
         list.add("three");
@@ -224,12 +220,12 @@ public class IteratorTagTest extends AbstractUITagTest {
         IteratorTag freshTag = new IteratorTag();
         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.",
+                        "May indicate that clearTagStateForTagPoolingServers() calls are not working properly.",
                 strutsBodyTagsAreReflectionEqual(tag, freshTag));
     }
 
     public void testIteratingWithIdSpecifiedAndNullElementOnCollection_clearTagStateSet() throws Exception {
-        List list = new ArrayList();
+        List<String> list = new ArrayList<>();
         list.add("one");
         list.add(null);
         list.add("three");
@@ -277,7 +273,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         freshTag.setPerformClearTagStateForTagPoolingServers(true);
         freshTag.setPageContext(pageContext);
         assertTrue("Tag state after doEndTag() and explicit tag state clearing is inequal to new Tag with pageContext/parent set.  " +
-                "May indicate that clearTagStateForTagPoolingServers() calls are not working properly.",
+                        "May indicate that clearTagStateForTagPoolingServers() calls are not working properly.",
                 strutsBodyTagsAreReflectionEqual(tag, freshTag));
     }
 
@@ -294,7 +290,7 @@ public class IteratorTagTest extends AbstractUITagTest {
 
     public void testCollectionIterator() {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
+        List<String> list = new ArrayList<>();
         list.add("test1");
         list.add("test2");
         list.add("test3");
@@ -314,7 +310,7 @@ public class IteratorTagTest extends AbstractUITagTest {
 
     public void testMapIterator() {
         Foo foo = new Foo();
-        HashMap map = new HashMap();
+        HashMap<String, String> map = new HashMap<>();
         map.put("test1", "123");
         map.put("test2", "456");
         map.put("test3", "789");
@@ -329,8 +325,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doStartTag();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_BODY_INCLUDE, result);
@@ -340,8 +335,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doAfterBody();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_BODY_AGAIN, result);
@@ -351,8 +345,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doAfterBody();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_BODY_AGAIN, result);
@@ -362,8 +355,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doAfterBody();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.SKIP_BODY, result);
@@ -372,8 +364,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doEndTag();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_PAGE, result);
@@ -382,13 +373,13 @@ public class IteratorTagTest extends AbstractUITagTest {
         IteratorTag freshTag = new IteratorTag();
         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.",
+                        "May indicate that clearTagStateForTagPoolingServers() calls are not working properly.",
                 strutsBodyTagsAreReflectionEqual(tag, freshTag));
     }
 
     public void testMapIterator_clearTagStateSet() {
         Foo foo = new Foo();
-        HashMap map = new HashMap();
+        HashMap<String, String> map = new HashMap<>();
         map.put("test1", "123");
         map.put("test2", "456");
         map.put("test3", "789");
@@ -405,8 +396,7 @@ public class IteratorTagTest extends AbstractUITagTest {
             result = tag.doStartTag();
             setComponentTagClearTagState(tag, true);  // Ensure component tag state clearing is set true (to match tag).
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_BODY_INCLUDE, result);
@@ -416,8 +406,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doAfterBody();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_BODY_AGAIN, result);
@@ -427,8 +416,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doAfterBody();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_BODY_AGAIN, result);
@@ -438,8 +426,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doAfterBody();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.SKIP_BODY, result);
@@ -448,8 +435,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doEndTag();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_PAGE, result);
@@ -459,7 +445,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         freshTag.setPerformClearTagStateForTagPoolingServers(true);
         freshTag.setPageContext(pageContext);
         assertTrue("Tag state after doEndTag() and explicit tag state clearing is inequal to new Tag with pageContext/parent set.  " +
-                "May indicate that clearTagStateForTagPoolingServers() calls are not working properly.",
+                        "May indicate that clearTagStateForTagPoolingServers() calls are not working properly.",
                 strutsBodyTagsAreReflectionEqual(tag, freshTag));
     }
 
@@ -477,8 +463,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doStartTag();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_BODY_INCLUDE, result);
@@ -490,15 +475,16 @@ public class IteratorTagTest extends AbstractUITagTest {
         assertFalse(status.isLast());
         assertTrue(status.isFirst());
         assertEquals(0, status.getIndex());
+        assertEquals("0", status.getIndexStr());
         assertEquals(1, status.getCount());
+        assertEquals("1", status.getCountStr());
         assertTrue(status.isOdd());
         assertFalse(status.isEven());
 
         try {
             result = tag.doAfterBody();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_BODY_AGAIN, result);
@@ -517,8 +503,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doAfterBody();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_BODY_AGAIN, result);
@@ -537,8 +522,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doEndTag();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_PAGE, result);
@@ -547,7 +531,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         IteratorTag freshTag = new IteratorTag();
         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.",
+                        "May indicate that clearTagStateForTagPoolingServers() calls are not working properly.",
                 strutsBodyTagsAreReflectionEqual(tag, freshTag));
     }
 
@@ -567,8 +551,7 @@ public class IteratorTagTest extends AbstractUITagTest {
             result = tag.doStartTag();
             setComponentTagClearTagState(tag, true);  // Ensure component tag state clearing is set true (to match tag).
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_BODY_INCLUDE, result);
@@ -587,8 +570,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doAfterBody();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_BODY_AGAIN, result);
@@ -607,8 +589,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doAfterBody();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_BODY_AGAIN, result);
@@ -627,8 +608,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doEndTag();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_PAGE, result);
@@ -638,7 +618,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         freshTag.setPerformClearTagStateForTagPoolingServers(true);
         freshTag.setPageContext(pageContext);
         assertTrue("Tag state after doEndTag() and explicit tag state clearing is inequal to new Tag with pageContext/parent set.  " +
-                "May indicate that clearTagStateForTagPoolingServers() calls are not working properly.",
+                        "May indicate that clearTagStateForTagPoolingServers() calls are not working properly.",
                 strutsBodyTagsAreReflectionEqual(tag, freshTag));
     }
 
@@ -666,7 +646,7 @@ public class IteratorTagTest extends AbstractUITagTest {
 
     public void testEmptyCollection() {
         Foo foo = new Foo();
-        foo.setList(new ArrayList());
+        foo.setList(new ArrayList<>());
 
         stack.push(foo);
 
@@ -692,17 +672,41 @@ public class IteratorTagTest extends AbstractUITagTest {
         validateCounter(new Integer[]{0, 1, 2, 3, 4, 5});
     }
 
-     public void testCounterWithStackValues() throws JspException {
+    public void testCounterWithDifferentLocale() throws JspException {
+        stack.getActionContext().withLocale(new Locale("fa_IR"));
+        tag.setVar("it");
+        tag.setBegin("0");
+        tag.setEnd("5");
+        List<String> expectedValues = Arrays.asList("0", "1", "2", "3", "4", "5");
+
+        ArrayList<String> values = new ArrayList<>();
+        try {
+            int result = tag.doStartTag();
+            assertEquals(TagSupport.EVAL_BODY_INCLUDE, result);
+            values.add((String) stack.findValue("it", String.class));
+        } catch (JspException e) {
+            fail(e.getMessage());
+        }
+
+        while (tag.doAfterBody() == TagSupport.EVAL_BODY_AGAIN) {
+            values.add((String) stack.findValue("top", String.class));
+        }
+
+        assertEquals(expectedValues.size(), values.size());
+        assertEquals(expectedValues, values);
+    }
+
+    public void testCounterWithStackValues() throws JspException {
         stack.getContext().put("begin", 0);
         stack.getContext().put("end", 5);
-        tag.setBegin("%{#begin}");
-        tag.setEnd("%{#end}");
+        tag.setBegin("begin");
+        tag.setEnd("end");
         validateCounter(new Integer[]{0, 1, 2, 3, 4, 5});
     }
 
     public void testCounterWithList() throws JspException {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<>();
         list.add("a");
         list.add("b");
         list.add("c");
@@ -720,7 +724,6 @@ public class IteratorTagTest extends AbstractUITagTest {
 
     public void testCounterWithArray() throws JspException {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
         foo.setArray(new String[]{"a", "b", "c", "d"});
 
         stack.push(foo);
@@ -735,7 +738,7 @@ public class IteratorTagTest extends AbstractUITagTest {
 
     public void testCounterWithListNoEnd() throws JspException {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<>();
         list.add("a");
         list.add("b");
         list.add("c");
@@ -752,7 +755,6 @@ public class IteratorTagTest extends AbstractUITagTest {
 
     public void testCounterWithArrayNoEnd() throws JspException {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
         foo.setArray(new String[]{"a", "b", "c", "d"});
 
         stack.push(foo);
@@ -765,7 +767,7 @@ public class IteratorTagTest extends AbstractUITagTest {
 
     public void testCounterWithList2() throws JspException {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<>();
         list.add("a");
         list.add("b");
         list.add("c");
@@ -783,7 +785,6 @@ public class IteratorTagTest extends AbstractUITagTest {
 
     public void testCounterWithArray2() throws JspException {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
         foo.setArray(new String[]{"a", "b", "c", "d"});
 
         stack.push(foo);
@@ -797,7 +798,7 @@ public class IteratorTagTest extends AbstractUITagTest {
 
     public void testCounterWithListNoEnd2() throws JspException {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<>();
         list.add("a");
         list.add("b");
         list.add("c");
@@ -812,9 +813,8 @@ public class IteratorTagTest extends AbstractUITagTest {
         validateCounter(new String[]{"c", "d"});
     }
 
-     public void testCounterWithArrayNoEnd2() throws JspException {
+    public void testCounterWithArrayNoEnd2() throws JspException {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
         foo.setArray(new String[]{"a", "b", "c", "d"});
 
         stack.push(foo);
@@ -838,9 +838,9 @@ public class IteratorTagTest extends AbstractUITagTest {
         validateCounter(new Integer[]{0, 2, 4});
     }
 
-     public void testCounterWithListAndStep() throws JspException {
+    public void testCounterWithListAndStep() throws JspException {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<>();
         list.add("a");
         list.add("b");
         list.add("c");
@@ -858,9 +858,8 @@ public class IteratorTagTest extends AbstractUITagTest {
         validateCounter(new String[]{"a", "c"});
     }
 
-     public void testCounterWithArrayAndStep() throws JspException {
+    public void testCounterWithArrayAndStep() throws JspException {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
         foo.setArray(new String[]{"a", "b", "c", "d"});
 
         stack.push(foo);
@@ -876,7 +875,7 @@ public class IteratorTagTest extends AbstractUITagTest {
 
     public void testCounterWithListAndStepNoEnd() throws JspException {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<>();
         list.add("a");
         list.add("b");
         list.add("c");
@@ -895,7 +894,6 @@ public class IteratorTagTest extends AbstractUITagTest {
 
     public void testCounterWithArrayAndStepNoEnd() throws JspException {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
         foo.setArray(new String[]{"a", "b", "c", "d"});
 
         stack.push(foo);
@@ -917,7 +915,7 @@ public class IteratorTagTest extends AbstractUITagTest {
 
     public void testCounterWithListAndNegativeStep() throws JspException {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<>();
         list.add("a");
         list.add("b");
         list.add("c");
@@ -937,7 +935,7 @@ public class IteratorTagTest extends AbstractUITagTest {
 
     public void testCounterWithListAndNegativeStepNoEnd() throws JspException {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<>();
         list.add("a");
         list.add("b");
         list.add("c");
@@ -954,9 +952,9 @@ public class IteratorTagTest extends AbstractUITagTest {
         validateCounter(new String[]{"d", "c", "b", "a"});
     }
 
-     public void testCounterWithArrayAndNegativeStep() throws JspException {
+    public void testCounterWithArrayAndNegativeStep() throws JspException {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<>();
         list.add("a");
         list.add("b");
         list.add("c");
@@ -976,7 +974,7 @@ public class IteratorTagTest extends AbstractUITagTest {
 
     public void testCounterWithArrayAndNegativeStepNoEnd() throws JspException {
         Foo foo = new Foo();
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<>();
         list.add("a");
         list.add("b");
         list.add("c");
@@ -994,14 +992,13 @@ public class IteratorTagTest extends AbstractUITagTest {
     }
 
     protected void validateCounter(Object[] expectedValues) throws JspException {
-        List values = new ArrayList();
+        ArrayList<Object> values = new ArrayList<>();
         try {
             int result = tag.doStartTag();
             assertEquals(TagSupport.EVAL_BODY_INCLUDE, result);
             values.add(stack.getRoot().peek());
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         while (tag.doAfterBody() == TagSupport.EVAL_BODY_AGAIN) {
@@ -1009,7 +1006,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         }
 
         assertEquals(expectedValues.length, values.size());
-        ListUtils.isEqualList(Arrays.asList(expectedValues), values);
+        assertTrue(ListUtils.isEqualList(Arrays.asList(expectedValues), values));
     }
 
     @Override
@@ -1033,8 +1030,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doStartTag();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_BODY_INCLUDE, result);
@@ -1044,8 +1040,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doAfterBody();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_BODY_AGAIN, result);
@@ -1055,8 +1050,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doAfterBody();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_BODY_AGAIN, result);
@@ -1066,8 +1060,7 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doAfterBody();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.SKIP_BODY, result);
@@ -1080,16 +1073,14 @@ public class IteratorTagTest extends AbstractUITagTest {
         try {
             result = tag.doStartTag();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.SKIP_BODY, result);
         try {
             result = tag.doEndTag();
         } catch (JspException e) {
-            e.printStackTrace();
-            fail();
+            fail(e.getMessage());
         }
 
         assertEquals(TagSupport.EVAL_PAGE, result);
@@ -1098,13 +1089,13 @@ public class IteratorTagTest extends AbstractUITagTest {
         IteratorTag freshTag = new IteratorTag();
         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.",
+                        "May indicate that clearTagStateForTagPoolingServers() calls are not working properly.",
                 strutsBodyTagsAreReflectionEqual(tag, freshTag));
     }
 
-    class Foo {
-        private Collection list;
-        private Map map;
+    static class Foo {
+        private Collection<String> list;
+        private Map<String, String> map;
         private String[] array;
 
         public void setArray(String[] array) {
@@ -1115,24 +1106,24 @@ public class IteratorTagTest extends AbstractUITagTest {
             return array;
         }
 
-        public void setList(Collection list) {
+        public void setList(Collection<String> list) {
             this.list = list;
         }
 
-        public Collection getList() {
+        public Collection<String> getList() {
             return list;
         }
 
-        public void setMap(Map map) {
+        public void setMap(Map<String, String> map) {
             this.map = map;
         }
 
-        public Map getMap() {
+        public Map<String, String> getMap() {
             return map;
         }
     }
 
-    class TestMockBodyContent extends MockBodyContent {
+    static class TestMockBodyContent extends MockBodyContent {
         public String getString() {
             return ".-.";
         }