From 52547ad375d46834fcb9b9227815d10eff2430da Mon Sep 17 00:00:00 2001 From: Alex Martel <13215031+manofthepeace@users.noreply.github.com> Date: Wed, 29 Nov 2023 16:18:04 -0500 Subject: [PATCH] Remove usage of deprecated jackson property --- .../xray/handlers/config/AWSServiceHandlerManifestTest.java | 4 ++-- .../main/java/com/amazonaws/xray/entities/EntityImpl.java | 4 ++-- .../java/com/amazonaws/xray/internal/UnsignedXrayClient.java | 5 ++--- .../xray/strategy/sampling/LocalizedSamplingStrategy.java | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/aws-xray-recorder-sdk-aws-sdk-core/src/test/java/com/amazonaws/xray/handlers/config/AWSServiceHandlerManifestTest.java b/aws-xray-recorder-sdk-aws-sdk-core/src/test/java/com/amazonaws/xray/handlers/config/AWSServiceHandlerManifestTest.java index 23b0746b..80c4d0bd 100644 --- a/aws-xray-recorder-sdk-aws-sdk-core/src/test/java/com/amazonaws/xray/handlers/config/AWSServiceHandlerManifestTest.java +++ b/aws-xray-recorder-sdk-aws-sdk-core/src/test/java/com/amazonaws/xray/handlers/config/AWSServiceHandlerManifestTest.java @@ -18,7 +18,7 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; import java.net.URL; import java.util.HashSet; import org.junit.Assert; @@ -35,7 +35,7 @@ public class AWSServiceHandlerManifestTest { AWSServiceHandlerManifestTest.class.getResource("/com/amazonaws/xray/handlers/config/OperationParameterWhitelist.json"); private ObjectMapper mapper = new ObjectMapper() - .setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES) + .setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .configure(JsonParser.Feature.ALLOW_COMMENTS, true); diff --git a/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/entities/EntityImpl.java b/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/entities/EntityImpl.java index 3f4d127a..aaf6c641 100644 --- a/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/entities/EntityImpl.java +++ b/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/entities/EntityImpl.java @@ -27,7 +27,7 @@ import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.Module; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.fasterxml.jackson.databind.SerializationConfig; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @@ -59,7 +59,7 @@ public abstract class EntityImpl implements Entity { @Deprecated protected static final ObjectMapper mapper = new ObjectMapper() .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false) - .setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES) + .setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE) .setSerializationInclusion(JsonInclude.Include.NON_EMPTY); private static final Log logger = LogFactory.getLog(EntityImpl.class); diff --git a/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/internal/UnsignedXrayClient.java b/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/internal/UnsignedXrayClient.java index da1b8085..71a3f67e 100644 --- a/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/internal/UnsignedXrayClient.java +++ b/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/internal/UnsignedXrayClient.java @@ -28,7 +28,7 @@ import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyName; -import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import com.fasterxml.jackson.databind.introspect.Annotated; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; @@ -62,8 +62,7 @@ public class UnsignedXrayClient { // Visible for testing static final ObjectMapper OBJECT_MAPPER = new ObjectMapper() .setSerializationInclusion(Include.NON_EMPTY) - // Use deprecated field to support older Jackson versions for now. - .setPropertyNamingStrategy(PropertyNamingStrategy.PASCAL_CASE_TO_CAMEL_CASE) + .setPropertyNamingStrategy(PropertyNamingStrategies.UPPER_CAMEL_CASE) .registerModule(new SimpleModule().addDeserializer(Date.class, new FloatDateDeserializer())) .setAnnotationIntrospector(new JacksonAnnotationIntrospector() { @Override diff --git a/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/strategy/sampling/LocalizedSamplingStrategy.java b/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/strategy/sampling/LocalizedSamplingStrategy.java index 92a44e68..6656b26f 100644 --- a/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/strategy/sampling/LocalizedSamplingStrategy.java +++ b/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/strategy/sampling/LocalizedSamplingStrategy.java @@ -20,7 +20,7 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; import java.io.IOException; import java.net.URL; import java.util.ArrayList; @@ -52,7 +52,7 @@ public class LocalizedSamplingStrategy implements SamplingStrategy { private static final ObjectMapper MAPPER = new ObjectMapper() - .setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES) + .setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .configure(JsonParser.Feature.ALLOW_COMMENTS, true);