Skip to content

Commit

Permalink
fix(deps): update com.fasterxml.jackson.core to v2.16.0
Browse files Browse the repository at this point in the history
Fixes #6124
  • Loading branch information
renovate-bot authored and vlsi committed Dec 14, 2023
1 parent 31c29af commit 311342a
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/bom-thirdparty/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ dependencies {

api("bsf:bsf:2.4.0")
api("cglib:cglib-nodep:3.3.0")
api("com.fasterxml.jackson.core:jackson-annotations:2.15.2")
api("com.fasterxml.jackson.core:jackson-core:2.15.2")
api("com.fasterxml.jackson.core:jackson-databind:2.15.2")
api("com.fasterxml.jackson.core:jackson-annotations:2.16.0")
api("com.fasterxml.jackson.core:jackson-core:2.16.0")
api("com.fasterxml.jackson.core:jackson-databind:2.16.0")
api("com.fifesoft:rsyntaxtextarea:3.3.4")
api("com.formdev:svgSalamander:1.1.4")
api("com.github.ben-manes.caffeine:caffeine:2.9.3")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
import org.slf4j.LoggerFactory;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.StreamReadFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.databind.node.NullNode;

import io.burt.jmespath.Expression;
Expand All @@ -56,7 +58,10 @@ public class JMESPathAssertion extends AbstractTestElement implements Serializab
private static final String EXPECT_NULL = "EXPECT_NULL";
private static final String INVERT = "INVERT";
private static final String ISREGEX = "ISREGEX";
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
static final ObjectMapper OBJECT_MAPPER = JsonMapper.builder()
// See https://github.com/FasterXML/jackson-core/issues/991
.enable(StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION)
.build();

private static final boolean USE_JAVA_REGEX = !JMeterUtils.getPropDefault(
"jmeter.regex.engine", "oro").equalsIgnoreCase("oro");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@
import org.slf4j.LoggerFactory;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.StreamReadFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;

import io.burt.jmespath.Expression;
Expand All @@ -59,7 +61,10 @@ public class JMESPathExtractor extends AbstractScopedTestElement
private static final String DEFAULT_VALUE = "JMESExtractor.defaultValue"; // $NON-NLS-1$
private static final String MATCH_NUMBER = "JMESExtractor.matchNumber"; // $NON-NLS-1$
private static final String REF_MATCH_NR = "_matchNr"; // $NON-NLS-1$
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
static final ObjectMapper OBJECT_MAPPER = JsonMapper.builder()
// See https://github.com/FasterXML/jackson-core/issues/991
.enable(StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION)
.build();

@Override
public void process() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
import org.slf4j.LoggerFactory;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.StreamReadFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.google.auto.service.AutoService;

Expand All @@ -36,7 +38,10 @@
@AutoService(ResultRenderer.class)
public class RenderAsJmesPathRenderer extends AbstractRenderAsJsonRenderer {
private static final Logger log = LoggerFactory.getLogger(RenderAsJmesPathRenderer.class);
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
static final ObjectMapper OBJECT_MAPPER = JsonMapper.builder()
// See https://github.com/FasterXML/jackson-core/issues/991
.enable(StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION)
.build();

@Override
protected String getTabLabel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.StreamReadFeature;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.json.JsonMapper;

/**
* Implementation of {@link DataExporter} that exports statistics to JSON
Expand All @@ -52,7 +53,11 @@ public class JsonExporter extends AbstractDataExporter {
public static final String OUTPUT_FILENAME = "statistics.json";
private static final FileFilter JSON_FILE_FILTER =
file -> file.isFile() && file.getName().equals(OUTPUT_FILENAME);
private final static ObjectWriter OBJECT_WRITER = new ObjectMapper().writerWithDefaultPrettyPrinter();
private final static ObjectWriter OBJECT_WRITER = JsonMapper.builder()
// See https://github.com/FasterXML/jackson-core/issues/991
.enable(StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION)
.build()
.writerWithDefaultPrettyPrinter();


public JsonExporter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@
import org.neo4j.driver.exceptions.Neo4jException;
import org.neo4j.driver.summary.ResultSummary;

import com.fasterxml.jackson.core.StreamReadFeature;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.json.JsonMapper;

@TestElementMetadata(labelResource = "displayName")
public class BoltSampler extends AbstractBoltTestElement implements Sampler, TestBean, ConfigMergabilityIndicator {
Expand All @@ -57,7 +58,12 @@ public class BoltSampler extends AbstractBoltTestElement implements Sampler, Tes

// Enables to initialize object mapper on demand
private static class Holder {
private static final ObjectReader OBJECT_READER = new ObjectMapper().readerFor(new TypeReference<HashMap<String, Object>>() {});
private static final ObjectReader OBJECT_READER = JsonMapper.builder()
// See https://github.com/FasterXML/jackson-core/issues/991
.enable(StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION)
.build()
.readerFor(new TypeReference<HashMap<String, Object>>() {
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
import org.xml.sax.helpers.DefaultHandler;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.StreamReadFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.google.auto.service.AutoService;

/**
Expand All @@ -76,7 +78,10 @@ public class DefaultSamplerCreator extends AbstractSamplerCreator {
private static final int SAMPLER_NAME_NAMING_MODE_SUFFIX = 2; // $NON-NLS-1$
private static final int SAMPLER_NAME_NAMING_MODE_FORMATTER = 3; // $NON_NLS-1$

private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private static final ObjectMapper OBJECT_MAPPER = JsonMapper.builder()
// See https://github.com/FasterXML/jackson-core/issues/991
.enable(StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION)
.build();
/**
*
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.StreamReadFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.fasterxml.jackson.databind.node.ObjectNode;

Expand All @@ -56,6 +58,11 @@ public final class GraphQLRequestParamUtils {

private static final JsonFactory jsonFactory = new JsonFactory();

private static final ObjectMapper OBJECT_MAPPER = JsonMapper.builder()
// See https://github.com/FasterXML/jackson-core/issues/991
.enable(StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION)
.build();

private GraphQLRequestParamUtils() {
}

Expand Down Expand Up @@ -133,11 +140,10 @@ public static GraphQLRequestParams toGraphQLRequestParams(byte[] postData, final
final String encoding = StringUtils.isNotEmpty(contentEncoding) ? contentEncoding
: EncoderCache.URL_ARGUMENT_ENCODING;

final ObjectMapper mapper = new ObjectMapper();
ObjectNode data;

try (InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(postData), encoding)) {
data = mapper.readValue(reader, ObjectNode.class);
data = OBJECT_MAPPER.readValue(reader, ObjectNode.class);
} catch (IOException e) {
throw new IllegalArgumentException("Invalid json data: " + e.getLocalizedMessage(), e);
}
Expand Down Expand Up @@ -166,7 +172,7 @@ public static GraphQLRequestParams toGraphQLRequestParams(byte[] postData, final
final JsonNodeType nodeType = variablesNode.getNodeType();
if (nodeType != JsonNodeType.NULL) {
if (nodeType == JsonNodeType.OBJECT) {
variables = mapper.writeValueAsString(variablesNode);
variables = OBJECT_MAPPER.writeValueAsString(variablesNode);
} else {
throw new IllegalArgumentException("Not a valid object node for GraphQL variables.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;

import com.fasterxml.jackson.core.StreamReadFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;

class TestGraphQLRequestParamUtils {

Expand Down Expand Up @@ -73,7 +75,10 @@ class TestGraphQLRequestParamUtils {
+ "\"query\":\"" + StringUtils.replace(QUERY.trim(), "\n", "\\n") + "\""
+ "}";

private static final ObjectMapper objectMapper = new ObjectMapper();
private static final ObjectMapper OBJECT_MAPPER = JsonMapper.builder()
// See https://github.com/FasterXML/jackson-core/issues/991
.enable(StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION)
.build();;

private GraphQLRequestParams params;

Expand Down Expand Up @@ -101,8 +106,8 @@ void testInvalidGraphQLContentType(String contentType) {
}

static Stream<org.junit.jupiter.params.provider.Arguments> postBodyFieldNameAndJsonNodes() throws Exception {
final JsonNode expectedPostBodyJson = objectMapper.readTree(EXPECTED_POST_BODY);
final JsonNode actualPostBodyJson = objectMapper.readTree(
final JsonNode expectedPostBodyJson = OBJECT_MAPPER.readTree(EXPECTED_POST_BODY);
final JsonNode actualPostBodyJson = OBJECT_MAPPER.readTree(
GraphQLRequestParamUtils.toPostBodyString(new GraphQLRequestParams(OPERATION_NAME, QUERY, VARIABLES)));
return Stream.of(
arguments(GraphQLRequestParamUtils.OPERATION_NAME_FIELD, expectedPostBodyJson, actualPostBodyJson),
Expand All @@ -124,8 +129,8 @@ void testQueryToGetParamValue() {

@Test
void testVariablesToGetParamValue() throws Exception {
assertEquals(objectMapper.readTree(EXPECTED_VARIABLES_GET_PARAM_VALUE),
objectMapper.readTree(GraphQLRequestParamUtils.variablesToGetParamValue(params.getVariables())));
assertEquals(OBJECT_MAPPER.readTree(EXPECTED_VARIABLES_GET_PARAM_VALUE),
OBJECT_MAPPER.readTree(GraphQLRequestParamUtils.variablesToGetParamValue(params.getVariables())));
}

@Test
Expand Down

0 comments on commit 311342a

Please sign in to comment.