struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [struts] 01/01: WW-3730 Avoids conversion to String[] of passed params
Date Sat, 21 Nov 2020 10:58:02 GMT
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 <lukaszlenart@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();
     }


Mime
View raw message