Relax limit on max string size (#96031)
Jackson 2.15 introduced a (rough) maximum limit on string length. This commit relaxes that limit to its maximum size, leaving document size constraints to other existing limits in the system. We can revisit whether string length within a document should be independently constrainted later.
This commit is contained in:
parent
40a22d1d0f
commit
1208c02cee
|
@ -10,8 +10,10 @@ package org.elasticsearch.xcontent.provider.json;
|
|||
|
||||
import com.fasterxml.jackson.core.JsonEncoding;
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import com.fasterxml.jackson.core.JsonFactoryBuilder;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.StreamReadConstraints;
|
||||
|
||||
import org.elasticsearch.xcontent.XContent;
|
||||
import org.elasticsearch.xcontent.XContentBuilder;
|
||||
|
@ -44,7 +46,12 @@ public class JsonXContentImpl implements XContent {
|
|||
}
|
||||
|
||||
static {
|
||||
jsonFactory = new JsonFactory();
|
||||
var builder = new JsonFactoryBuilder();
|
||||
// jackson 2.15 introduced a max string length. We have other limits in place to constrain max doc size,
|
||||
// so here we set to max value (2GiB) so as not to constrain further than those existing limits.
|
||||
builder.streamReadConstraints(StreamReadConstraints.builder().maxStringLength(Integer.MAX_VALUE).build());
|
||||
|
||||
jsonFactory = builder.build();
|
||||
jsonFactory.configure(JsonGenerator.Feature.QUOTE_FIELD_NAMES, true);
|
||||
jsonFactory.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
|
||||
jsonFactory.configure(JsonFactory.Feature.FAIL_ON_SYMBOL_HASH_OVERFLOW, false); // this trips on many mappings now...
|
||||
|
|
Loading…
Reference in New Issue