Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.core.util.JsonRecyclerPools;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
Expand Down Expand Up @@ -158,12 +159,14 @@ public static JsonFactory jsonFactory()
// due to the limits introduced by Jackson 2.15
public static JsonFactoryBuilder jsonFactoryBuilder()
{
// https://github.com/FasterXML/jackson-core/issues/1256
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is weird that the link to FasterXML/jackson-core#1256 is not next to the line with recyclerPool.
is this really what you wanted @electrum in #21361 (comment) ?

return new JsonFactoryBuilder()
.streamReadConstraints(StreamReadConstraints.builder()
.maxStringLength(Integer.MAX_VALUE)
.maxNestingDepth(Integer.MAX_VALUE)
.maxNumberLength(Integer.MAX_VALUE)
.build());
.build())
.recyclerPool(JsonRecyclerPools.threadLocalPool());
}

private interface ParserConstructor<I>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.core.util.JsonRecyclerPools;
import com.fasterxml.jackson.databind.JsonNode;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -81,6 +82,13 @@ public void testFactoryHasNoReadConstraints()
assertReadConstraints(jsonFactoryBuilder().build().streamReadConstraints());
}

@Test
public void testFactoryHasThreadLocalRecycler()
{
assertThat(jsonFactory()._getRecyclerPool()).isEqualTo(JsonRecyclerPools.threadLocalPool());
assertThat(jsonFactoryBuilder().build()._getRecyclerPool()).isEqualTo(JsonRecyclerPools.threadLocalPool());
}

@Test
public void testBuilderHasNoReadConstraints()
{
Expand Down