janhoy commented on code in PR #4606:
URL: https://github.com/apache/solr/pull/4606#discussion_r3520668488
##########
solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java:
##########
@@ -458,25 +458,20 @@ public NamedList<Object> toNamedList() {
* empty.
*/
public String toQueryString() {
- try {
- final String charset = StandardCharsets.UTF_8.name();
- final StringBuilder sb = new StringBuilder(128);
- boolean first = true;
- for (final Iterator<String> it = getParameterNamesIterator();
it.hasNext(); ) {
- final String name = it.next(), nameEnc = URLEncoder.encode(name,
charset);
- for (String val : getParams(name)) {
- sb.append(first ? '?' : '&')
- .append(nameEnc)
- .append('=')
- .append(URLEncoder.encode(val, charset));
- first = false;
- }
+ final Charset charset = StandardCharsets.UTF_8;
+ final StringBuilder sb = new StringBuilder(128);
Review Comment:
Perhaps you want to open another PR with that optimization. Looks like it
can make some code more compact.
--
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]