Don't allow XContentBuilder#writeValue(TimeValue)

We have specific support for writing `TimeValue`s in the form of
`XContentBuilder#timeValueField`. Writing a `TimeValue` using
`XContentBuilder#writeValue` is a bug waiting to happen.
This commit is contained in:
Nik Everett 2016-08-31 13:23:38 -04:00
parent dcaed58f90
commit 7f70c00dad
1 changed files with 1 additions and 0 deletions

View File

@ -886,6 +886,7 @@ public final class XContentBuilder implements BytesStream, Releasable {
generator.writeNull();
return;
}
assert false == value instanceof TimeValue : "Use timeValueField instead";
Class<?> type = value.getClass();
Writer writer = MAP.get(type);
if (writer != null) {