martin-g commented on a change in pull request #454:
URL: https://github.com/apache/wicket/pull/454#discussion_r495698598



##########
File path: 
wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/PageParameters.java
##########
@@ -294,35 +293,48 @@ public PageParameters add(final String name, final Object 
value, final int index
                Args.notEmpty(name, "name");
                Args.notNull(value, "value");
 
-               if (namedParameters == null)
-               {
-                       namedParameters = new ArrayList<>(1);
-               }
-
-               List<String> values = new ArrayList<>();
                if (value instanceof String[])
                {
-                       values.addAll(Arrays.asList((String[])value));
+                       addNamed(name, (String[]) value, index, type);
                }
                else
                {
-                       values.add(value.toString());
+                       addNamed(name, value.toString(), index, type);
+               }
+
+               return this;
+       }
+
+       private void addNamed(String name, String[] values, int index, Type 
type) 
+       {
+               if (namedParameters == null)

Review comment:
       It would be better to add `&& values.length > 0` 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to