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:
Yonik Seeley 2007-02-05 18:22:04 +00:00
parent 24d527bb51
commit 64166984f6
1 changed files with 5 additions and 2 deletions

View File

@ -254,7 +254,6 @@ class JSONWriter extends TextResponseWriter {
// NamedList("a"=1,"b"=2,null=3) => ["a",1,"b",2,null,3]
protected void writeNamedListAsFlat(String name, NamedList val) throws IOException {
int sz = val.size();
indent();
writer.write('[');
incLevel();
@ -264,7 +263,11 @@ class JSONWriter extends TextResponseWriter {
}
String key = val.getName(i);
indent();
writeStr(null, key, true);
if (key==null) {
writeNull(null);
} else {
writeStr(null, key, true);
}
writer.write(',');
writeVal(key, val.getVal(i));
}