mirror of https://github.com/apache/lucene.git
SOLR-13783: Add space after comma in NamedList.toString() (#979)
This commit is contained in:
parent
ee82e4567f
commit
74333c3af2
|
@ -31,6 +31,10 @@ Jetty 9.4.19.v20190610
|
|||
Upgrade 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)
|
||||
|
||||
|
|
|
@ -401,7 +401,7 @@ public class NamedList<T> implements Cloneable, Serializable, Iterable<Map.Entry
|
|||
sb.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));
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue