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 2020/11/21 10:58:01 UTC

[struts] branch WW-3730-use-params-directly created (now 8996e0a)

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

lukaszlenart pushed a change to branch WW-3730-use-params-directly
in repository https://gitbox.apache.org/repos/asf/struts.git.


      at 8996e0a  WW-3730 Avoids conversion to String[] of passed params

This branch includes the following new commits:

     new 8996e0a  WW-3730 Avoids conversion to String[] of passed params

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-3730 Avoids conversion to String[] of passed params

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

lukaszlenart pushed a commit to branch WW-3730-use-params-directly
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 8996e0ad9733d7b95fc8f163d7df633cbe1221fa
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Sat Nov 21 11:57:51 2020 +0100

    WW-3730 Avoids conversion to String[] of passed params
---
 .../org/apache/struts2/components/ActionComponent.java | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/core/src/main/java/org/apache/struts2/components/ActionComponent.java b/core/src/main/java/org/apache/struts2/components/ActionComponent.java
index 98251ba..af1ebd2 100644
--- a/core/src/main/java/org/apache/struts2/components/ActionComponent.java
+++ b/core/src/main/java/org/apache/struts2/components/ActionComponent.java
@@ -214,24 +214,10 @@ public class ActionComponent extends ContextBean {
             parentParams = getStack().getActionContext().getParameters();
         }
 
-        HttpParameters.Builder builder = HttpParameters.create();
-        if (parentParams != null) {
-            builder = builder.withParent(parentParams);
-        }
+        HttpParameters.Builder builder = HttpParameters.create().withParent(parentParams);
 
         if (parameters != null) {
-            Map<String, String[]> params = new HashMap<>();
-            for (Object o : parameters.entrySet()) {
-                Map.Entry entry = (Map.Entry) o;
-                String key = (String) entry.getKey();
-                Object val = entry.getValue();
-                if (val.getClass().isArray() && String.class == val.getClass().getComponentType()) {
-                    params.put(key, (String[])val);
-                } else {
-                    params.put(key, new String[]{val.toString()});
-                }
-            }
-            builder = builder.withExtraParams(params);
+            builder = builder.withExtraParams(parameters);
         }
         return builder.build();
     }