Skip to content

Commit

Permalink
Merge test fixes from #3805 to make test suite pass again
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Mar 6, 2023
1 parent dfc8bfd commit 7345d2d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.fasterxml.jackson.databind.deser.dos;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.json.JsonMapper;

// [databind#3397], wrt JsonNode
public class DeepJsonNodeDeser3397Test extends BaseMapTest
Expand All @@ -10,9 +13,12 @@ public class DeepJsonNodeDeser3397Test extends BaseMapTest
// ... currently gets a bit slow at 1M but passes.
// But test with 100k as practical limit, to guard against regression
// private final static int TOO_DEEP_NESTING = 1_000_000;
private final static int TOO_DEEP_NESTING = 100_00;
private final static int TOO_DEEP_NESTING = 10_000;

private final ObjectMapper MAPPER = newJsonMapper();
private final JsonFactory jsonFactory = JsonFactory.builder()
.streamReadConstraints(StreamReadConstraints.builder().maxNestingDepth(Integer.MAX_VALUE).build())
.build();
private final ObjectMapper MAPPER = JsonMapper.builder(jsonFactory).build();

public void testTreeWithArray() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package com.fasterxml.jackson.databind.deser.dos;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.databind.BaseMapTest;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;

public class DeepJsonNodeSerTest extends BaseMapTest
{
private final ObjectMapper MAPPER = newJsonMapper();
private final JsonFactory jsonFactory = JsonFactory.builder()
.streamReadConstraints(StreamReadConstraints.builder().maxNestingDepth(Integer.MAX_VALUE).build())
.build();
private final ObjectMapper MAPPER = JsonMapper.builder(jsonFactory).build();

public void testVeryDeepNodeSer() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.databind.BaseMapTest;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;

// For [databind#2816] / [databind#3473]
public class DeepNestingUntypedDeserTest extends BaseMapTest
Expand All @@ -17,7 +20,10 @@ public class DeepNestingUntypedDeserTest extends BaseMapTest
// 1 million (!) nesting levels, but to keep tests fast use 100k
private final static int TOO_DEEP_NESTING = 100_000;

private final ObjectMapper MAPPER = newJsonMapper();
private final JsonFactory jsonFactory = JsonFactory.builder()
.streamReadConstraints(StreamReadConstraints.builder().maxNestingDepth(Integer.MAX_VALUE).build())
.build();
private final ObjectMapper MAPPER = JsonMapper.builder(jsonFactory).build();

public void testFormerlyTooDeepUntypedWithArray() throws Exception
{
Expand Down

0 comments on commit 7345d2d

Please sign in to comment.