mirror of https://github.com/apache/lucene.git
handle null key for json.nl=flat
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@503795 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
24d527bb51
commit
64166984f6
|
@ -254,7 +254,6 @@ class JSONWriter extends TextResponseWriter {
|
||||||
// NamedList("a"=1,"b"=2,null=3) => ["a",1,"b",2,null,3]
|
// NamedList("a"=1,"b"=2,null=3) => ["a",1,"b",2,null,3]
|
||||||
protected void writeNamedListAsFlat(String name, NamedList val) throws IOException {
|
protected void writeNamedListAsFlat(String name, NamedList val) throws IOException {
|
||||||
int sz = val.size();
|
int sz = val.size();
|
||||||
indent();
|
|
||||||
writer.write('[');
|
writer.write('[');
|
||||||
incLevel();
|
incLevel();
|
||||||
|
|
||||||
|
@ -264,7 +263,11 @@ class JSONWriter extends TextResponseWriter {
|
||||||
}
|
}
|
||||||
String key = val.getName(i);
|
String key = val.getName(i);
|
||||||
indent();
|
indent();
|
||||||
|
if (key==null) {
|
||||||
|
writeNull(null);
|
||||||
|
} else {
|
||||||
writeStr(null, key, true);
|
writeStr(null, key, true);
|
||||||
|
}
|
||||||
writer.write(',');
|
writer.write(',');
|
||||||
writeVal(key, val.getVal(i));
|
writeVal(key, val.getVal(i));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue