IOException when returning nested arrays. See: https://gist.github.com/2006593
This commit is contained in:
parent
1ed07a0c50
commit
0badf3d92a
|
@ -742,6 +742,8 @@ public final class XContentBuilder {
|
||||||
} else if (value instanceof Map) {
|
} else if (value instanceof Map) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
value((Map<String, Object>) value);
|
value((Map<String, Object>) value);
|
||||||
|
} else if (value instanceof Iterable) {
|
||||||
|
value((Iterable) value);
|
||||||
} else {
|
} else {
|
||||||
throw new IOException("Type not allowed [" + type + "]");
|
throw new IOException("Type not allowed [" + type + "]");
|
||||||
}
|
}
|
||||||
|
@ -965,6 +967,18 @@ public final class XContentBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public XContentBuilder value(Iterable value) throws IOException {
|
||||||
|
if (value == null) {
|
||||||
|
return nullValue();
|
||||||
|
}
|
||||||
|
startArray();
|
||||||
|
for (Object o : value) {
|
||||||
|
value(o);
|
||||||
|
}
|
||||||
|
endArray();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public XContentBuilder copyCurrentStructure(XContentParser parser) throws IOException {
|
public XContentBuilder copyCurrentStructure(XContentParser parser) throws IOException {
|
||||||
generator.copyCurrentStructure(parser);
|
generator.copyCurrentStructure(parser);
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in New Issue