diff --git a/pom.xml b/pom.xml index aa50f8f8..d66a877f 100644 --- a/pom.xml +++ b/pom.xml @@ -63,7 +63,7 @@ com.fasterxml.jackson.core jackson-core - 2.15.4 + 2.20.1 jar compile false @@ -71,7 +71,7 @@ com.fasterxml.jackson.core jackson-databind - 2.15.4 + 2.20.1 jar compile false @@ -79,7 +79,7 @@ com.fasterxml.jackson.core jackson-annotations - 2.15.4 + 2.20 jar compile false diff --git a/src/main/java/io/fusionauth/jwt/json/Mapper.java b/src/main/java/io/fusionauth/jwt/json/Mapper.java index 483966f1..1b4ac6fc 100644 --- a/src/main/java/io/fusionauth/jwt/json/Mapper.java +++ b/src/main/java/io/fusionauth/jwt/json/Mapper.java @@ -67,8 +67,7 @@ public static byte[] serialize(Object object) throws InvalidJWTException { } static { - OBJECT_MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL) - .configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false) + OBJECT_MAPPER.setDefaultPropertyInclusion(JsonInclude.Include.NON_NULL) .configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true) .configure(DeserializationFeature.USE_BIG_INTEGER_FOR_INTS, true) .registerModule(new JacksonModule()); diff --git a/src/main/java/io/fusionauth/jwt/json/ZonedDateTimeDeserializer.java b/src/main/java/io/fusionauth/jwt/json/ZonedDateTimeDeserializer.java index cc253b5c..eff89db0 100644 --- a/src/main/java/io/fusionauth/jwt/json/ZonedDateTimeDeserializer.java +++ b/src/main/java/io/fusionauth/jwt/json/ZonedDateTimeDeserializer.java @@ -51,10 +51,12 @@ public ZonedDateTime deserialize(JsonParser jp, DeserializationContext ctxt) thr try { value = Long.parseLong(str); } catch (NumberFormatException e) { - throw ctxt.mappingException(handledType()); + ctxt.reportInputMismatch(handledType(), "Cannot parse string '%s' as a valid epoch timestamp", str); + return null; // This line should never be reached if reportInputMismatch throws internally } } else { - throw ctxt.mappingException(handledType()); + ctxt.handleUnexpectedToken(handledType(), jp); + return null; // This line should never be reached if handleUnexpectedToken throws internally } return Instant.ofEpochSecond(value).atZone(ZoneOffset.UTC);