Closed
Description
class: org.elasticsearch.common.xcontent.XContentBuilder
method: field(String name, Object value)
} else if (type == Byte.class) {
field(name, ((Byte) value).byteValue());
} else if (type == Boolean.class) {
field(name, ((Boolean) value).booleanValue());
} else if (type == Date.class) {
field(name, (Date) value);
} else if (type == byte[].class) {
While it is ok to use type == xxx.class
for final java classes I don't think it should be used for Date. Instead instanceof
should be used so that the following method calls behave the same:
xContentBuilder.field(field, (Date) dateValue)
xContentBuilder.field(field, (Object) dateValue)