Apache Lucene open-source search software
SOLR-13783: Add space after comma in NamedList.toString() (#979)
Chris Hennick74333c3af2b7
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex e46265512fe..5421065539e 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -31,6 +31,10 @@ Jetty 9.4.19.v20190610Upgrade Notes----------------------+* SOLR-13783: In situations where a NamedList must be output as plain text, commas between key-value pairs will now be+ followed by a space (e.g. {shape=square, color=yellow} rather than {shape=square,color=yellow}) for consistency with+ other java.util.Map implementations based on AbstractMap (Chris Hennick).+* LUCENE-8738: Move to Java 11 as minimum Java version.(Adrien Grand, Uwe Schindler)diff --git a/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java b/solr/solrj/src/java/org/apache/solr/common/util/NamedList.javaindex f21705aef9e..3113ef95337 100644--- a/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java+++ b/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java@@ -401,7 +401,7 @@ public class NamedList<T> implements Cloneable, Serializable, Iterable<Map.Entrysb.append('{');int sz = size();for (int i=0; i<sz; i++) {- if (i != 0) sb.append(',');+ if (i != 0) sb.append(", ");sb.append(getName(i));sb.append('=');sb.append(getVal(i));diff --git a/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java b/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.javaindex 644257bed6c..cd737c2253a 100644--- a/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java+++ b/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java@@ -26,6 +26,16 @@ import org.junit.Test;public class NamedListTest extends SolrTestCase {+ @Test+ public void testToString() {+ NamedList<String> nl = new NamedList<>();+ assertEquals("{}", nl.toString());+ nl.add("key1", "value1");+ assertEquals("{key1=value1}", nl.toString());+ nl.add("key2", "value2");+ assertEquals("{key1=value1, key2=value2}", nl.toString());+ }+public void testRemove() {NamedList<String> nl = new NamedList<>();nl.add("key1", "value1");