renatoh commented on code in PR #4628:
URL: https://github.com/apache/solr/pull/4628#discussion_r3638037930


##########
solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java:
##########
@@ -459,19 +460,16 @@ public NamedList<Object> toNamedList() {
    */
   public String toQueryString() {
     final Charset charset = StandardCharsets.UTF_8;
-    final StringBuilder sb = new StringBuilder(128);
-    boolean first = true;
+
+    var output = new StringJoiner("&", "?", "");
+    output.setEmptyValue("");
     for (final Iterator<String> it = getParameterNamesIterator(); 
it.hasNext(); ) {
-      final String name = it.next(), nameEnc = URLEncoder.encode(name, 
charset);
+      final String name = it.next();
       for (String val : getParams(name)) {
-        sb.append(first ? '?' : '&')
-            .append(nameEnc)
-            .append('=')
-            .append(URLEncoder.encode(val, charset));
-        first = false;
+        output.add(URLEncoder.encode(name, charset) + "=" + 
URLEncoder.encode(val, charset));

Review Comment:
   @chan-dx good catch, thanks for the suggestion!



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to