diff options
author | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2023-05-09 15:46:32 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2023-05-09 15:59:59 +0200 |
commit | ad7aed9bb7b529cc98acf46763cd869523296fbc (patch) | |
tree | 1025fa907e90eefd7587b81f90ad6fbb575dc8c6 /vespa-feed-client | |
parent | 9904aaf25710c6affca4140c22fa99501eb325fd (diff) |
Disable string length restriction introduced in Jackson 2.15
Disable restriction only for parsers/generators which is likely to handle literals exceeding 5M
Diffstat (limited to 'vespa-feed-client')
-rw-r--r-- | vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpFeedClient.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpFeedClient.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpFeedClient.java index cad2da4d242..3f54808a758 100644 --- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpFeedClient.java +++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpFeedClient.java @@ -11,14 +11,14 @@ import ai.vespa.feed.client.Result; import ai.vespa.feed.client.ResultException; import ai.vespa.feed.client.ResultParseException; import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonFactoryBuilder; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.StreamReadConstraints; import java.io.IOException; -import java.io.UncheckedIOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; import java.time.Duration; import java.util.HashMap; import java.util.Map; @@ -43,7 +43,9 @@ import static java.util.Objects.requireNonNull; */ class HttpFeedClient implements FeedClient { - private static final JsonFactory factory = new JsonFactory(); + private static final JsonFactory jsonParserFactory = new JsonFactoryBuilder() + .streamReadConstraints(StreamReadConstraints.builder().maxStringLength(Integer.MAX_VALUE).build()) + .build(); private final Map<String, Supplier<String>> requestHeaders; private final RequestStrategy requestStrategy; @@ -195,7 +197,7 @@ class HttpFeedClient implements FeedClient { static MessageAndTrace parse(DocumentId documentId, byte[] json) { String message = null; String trace = null; - try (JsonParser parser = factory.createParser(json)) { + try (JsonParser parser = jsonParserFactory.createParser(json)) { if (parser.nextToken() != JsonToken.START_OBJECT) throw new ResultParseException( documentId, |