From 2081f9aeb7bd54f92e1b6adf8a88e985da263bd1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2019 12:21:26 -0800 Subject: [PATCH] Bump jackson.version from 2.9.7 to 2.10.1 (#207) * Bump jackson.version from 2.9.7 to 2.10.1 Bumps `jackson.version` from 2.9.7 to 2.10.1. Updates `jackson-databind` from 2.9.7 to 2.10.1 - [Release notes](https://github.com/FasterXML/jackson/releases) - [Commits](https://github.com/FasterXML/jackson/commits) Updates `jackson-dataformat-cbor` from 2.9.7 to 2.10.1 - [Release notes](https://github.com/FasterXML/jackson-dataformats-binary/releases) - [Commits](https://github.com/FasterXML/jackson-dataformats-binary/compare/jackson-dataformats-binary-2.9.7...jackson-dataformats-binary-2.10.1) Updates `jackson-datatype-jsr310` from 2.9.7 to 2.10.1 Updates `jackson-modules-java8` from 2.9.7 to 2.10.1 - [Release notes](https://github.com/FasterXML/jackson-modules-java8/releases) - [Commits](https://github.com/FasterXML/jackson-modules-java8/compare/jackson-modules-java8-2.9.7...jackson-modules-java8-2.10.1) Signed-off-by: dependabot[bot] * Fixes related to jackson-databind upgrade * Minor change to exception handling to account for behavioural change in https://github.com/FasterXML/jackson-databind/issues/1675 --- pom.xml | 2 +- .../amazon/cloudformation/proxy/StdCallbackContext.java | 4 +++- .../software/amazon/cloudformation/resource/Serializer.java | 4 ++-- .../amazon/cloudformation/proxy/StdCallackContextTest.java | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index ce26c55f..e678cb4a 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,7 @@ 2.10.19 8.18 2.6 - 2.9.7 + 2.10.1 3.1.0 2.26.0 3.1.11 diff --git a/src/main/java/software/amazon/cloudformation/proxy/StdCallbackContext.java b/src/main/java/software/amazon/cloudformation/proxy/StdCallbackContext.java index b41e3194..a4def297 100644 --- a/src/main/java/software/amazon/cloudformation/proxy/StdCallbackContext.java +++ b/src/main/java/software/amazon/cloudformation/proxy/StdCallbackContext.java @@ -21,6 +21,7 @@ import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -148,7 +149,8 @@ private Map readMap(Class type, JsonParser p, Deserialization } return value; } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { - throw new IOException("Can not create empty map for class " + type + " @ " + p.getCurrentLocation(), e); + throw new JsonMappingException(p, "Can not create empty map for class " + type + " @ " + p.getCurrentLocation(), + e); } } diff --git a/src/main/java/software/amazon/cloudformation/resource/Serializer.java b/src/main/java/software/amazon/cloudformation/resource/Serializer.java index 6aff7ba6..39b03770 100644 --- a/src/main/java/software/amazon/cloudformation/resource/Serializer.java +++ b/src/main/java/software/amazon/cloudformation/resource/Serializer.java @@ -78,11 +78,11 @@ public String serialize(final T modelObject) throws JsonProcessingException return OBJECT_MAPPER.writeValueAsString(modelObject); } - public T deserialize(final String s, final TypeReference reference) throws IOException { + public T deserialize(final String s, final TypeReference reference) throws IOException { return OBJECT_MAPPER.readValue(s, reference); } - public T deserializeStrict(final String s, final TypeReference reference) throws IOException { + public T deserializeStrict(final String s, final TypeReference reference) throws IOException { return STRICT_OBJECT_MAPPER.readValue(s, reference); } } diff --git a/src/test/java/software/amazon/cloudformation/proxy/StdCallackContextTest.java b/src/test/java/software/amazon/cloudformation/proxy/StdCallackContextTest.java index 1d358574..7871f1bc 100644 --- a/src/test/java/software/amazon/cloudformation/proxy/StdCallackContextTest.java +++ b/src/test/java/software/amazon/cloudformation/proxy/StdCallackContextTest.java @@ -230,7 +230,7 @@ public void testIncorrectJSONException() throws IOException { parseException = (JsonParseException) exception.getCause(); assertThat(parseException.getMessage()).contains("Encoded Class value not present"); - IOException ioException = assertThrows(IOException.class, () -> { + JsonMappingException ioException = assertThrows(JsonMappingException.class, () -> { String json = "{\"callGraphs\": {\"foo\": 1, \"bar\": [\"java.util.Map\", { \"1\": 2 }]}}"; serializer.deserialize(json, new TypeReference() { });