Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package jackson-databind for
openSUSE:Factory checked in at 2024-08-14 14:14:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/jackson-databind (Old)
and /work/SRC/openSUSE:Factory/.jackson-databind.new.7232 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "jackson-databind"
Wed Aug 14 14:14:56 2024 rev:14 rq:1193674 version:2.17.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/jackson-databind/jackson-databind.changes
2024-05-21 18:35:49.545031509 +0200
+++
/work/SRC/openSUSE:Factory/.jackson-databind.new.7232/jackson-databind.changes
2024-08-14 14:15:32.614276336 +0200
@@ -1,0 +2,16 @@
+Wed Aug 7 09:01:52 UTC 2024 - Fridrich Strba <[email protected]>
+
+- Update to 2.17.2
+ * #4561: Issues using jackson-databind 2.17.1 with Reactor
+ * #4575: StdDelegatingSerializer does not consider a Converter
+ that may return null for a non-null input
+ * #4577: Cannot deserialize value of type 'java.math.BigDecimal'
+ from String "3." (not a valid representation)
+ * #4595: No way to explicitly disable wrapping in custom
+ annotation processor
+ * #4607: 'MismatchedInput': No Object Id found for an instance of
+ X to assign to property '@id'
+ * #4610: 'DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS'
+ does not work when used with Polymorphic type handling
+
+-------------------------------------------------------------------
@@ -5,4 +21,71 @@
- * No changes since 2.17.0
-- Includes changes from 2.17.0
- * #242: Allow `@JsonAnySetter` on `ElementType.PARAMETER` (for
- use on constructor parameters)
+ * 2.17.1 (04-May-2024)
+ + #4428: 'ByteBuddy' scope went beyond 'test' in version 2.17.0
+ + #4430: Use 'ReentrantLock' instead of 'synchronized' in
+ 'DeserializerCache' to avoid deadlock on pinning
+ + #4435: Cannot deserialize value of type 'java.math.BigDecimal'
+ from String ".05": not a valid representation
+ + #4441: '@JsonSetter(nulls = Nulls.SKIP)' doesn't work in some
+ situations
+ + #4450: Empty QName deserialized as 'null'
+ + #4471: Reconsider deprecation of
+ 'JsonNode.asText(defaultValue)'
+ + #4481: Unable to override
+ 'DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL' with
+ 'JsonFormat.Feature.READ_UNKNOWN_ENUM_VALUES_AS_NULL'
+ + #4489: Unable to override 'DeserializationFeature
+ .READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE' with
+ 'JsonFormat.Feature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE'
+ * 2.17.0 (12-Mar-2024)
+ + #437: Support throwing 'MismatchedInputException' when
+ deserializing properties that are not part of the view
+ + #736: 'MapperFeature.REQUIRE_SETTERS_FOR_GETTERS' has no effect
+ + #2543: Introspection includes delegating ctor's only parameter
+ as a property in 'BeanDescription'
+ + #4160: Deprecate 'DefaultTyping.EVERYTHING' in '2.x' and
+ remove in '3.0'
+ + #4194: Add 'JsonNodeFeature
+ .FAIL_ON_NAN_TO_BIG_DECIMAL_COERCION' option to fail on
+ attempting to coerce 'NaN' into 'BigDecimal'
+ + #4205: Consider types in 'sun.*' package(s) to be JDK
+ (platform) types for purposes of handling
+ + #4209: Make 'BeanDeserializerModifier'/'BeanSerializerModifier'
+ implement 'java.io.Serializable'
+ + #4214: 'EnumSet' deserialization does not work when we
+ activate default typing in 'ObjectMapper'
+ + #4248: 'ThrowableDeserializer' does not handle 'null' well for
+ 'cause'
+ + #4250: Add input validation for 'NumberDeserializers'
+ deserializers for "stringified" FP numbers
+ + #4262: Improve handling of 'null' insertion failure for
+ 'TreeSet'
+ + #4263: Change 'ObjectArrayDeserializer' to use "generic" type
+ parameter ('java.lang.Object') to remove co-variant return
+ type
+ + #4299: Some 'Collection' and 'Map' fallbacks don't work in
+ GraalVM native image
+ + #4309: '@JsonSetter(nulls=...)' handling of 'Collection'
+ 'null' values during deserialization with
+ 'READ_UNKNOWN_ENUM_VALUES_AS_NULL' and
+ 'FAIL_ON_INVALID_SUBTYPE' wrong
+ + #4327: '@JsonAlias' not respected by polymorphic deduction
+ + #4337: 'AtomicReference' serializer does not support
+ '@JsonSerialize(contentConverter=...)'
+ + #4364: '@JsonProperty' and equivalents should merge with
+ 'AnnotationIntrospectorPair'
+ + #4394: Better Base64 support for 'java.util.UUIDs' without
+ padding
+ + #4403: Deserialization of unknown value for enums does not
+ yield default enum value
+ + #4416: Deprecate 'JsonNode.asText(String)'
+ * 2.16.2 (09-Mar-2024)
+ + #4302: Problem deserializing some type of Enums when using
+ 'PropertyNamingStrategy'
+ + #4303: 'ObjectReader' is not serializable if it's configured
+ for polymorphism
+ + #4316: NPE when deserializing 'JsonAnySetter' in 'Throwable'
+ + #4355: Jackson 2.16 fails attempting to obtain 'ObjectWriter'
+ for an 'Enum' of which some value returns null from
+ 'toString()'
+ + #4409: Deserialization of enums with name defined with
+ different cases leads to 'InvalidDefinitionException':
+ Multiple fields representing property
Old:
----
jackson-databind-2.17.1.tar.gz
New:
----
jackson-databind-2.17.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ jackson-databind.spec ++++++
--- /var/tmp/diff_new_pack.m5LQnB/_old 2024-08-14 14:15:33.122297573 +0200
+++ /var/tmp/diff_new_pack.m5LQnB/_new 2024-08-14 14:15:33.122297573 +0200
@@ -17,7 +17,7 @@
Name: jackson-databind
-Version: 2.17.1
+Version: 2.17.2
Release: 0
Summary: General data-binding package for Jackson (2.x)
License: Apache-2.0 AND LGPL-2.1-or-later
++++++ jackson-databind-2.17.1.tar.gz -> jackson-databind-2.17.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jackson-databind-jackson-databind-2.17.1/pom.xml
new/jackson-databind-jackson-databind-2.17.2/pom.xml
--- old/jackson-databind-jackson-databind-2.17.1/pom.xml 2024-05-05
04:07:04.000000000 +0200
+++ new/jackson-databind-jackson-databind-2.17.2/pom.xml 2024-07-05
19:15:02.000000000 +0200
@@ -9,11 +9,11 @@
<parent>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-base</artifactId>
- <version>2.17.1</version>
+ <version>2.17.2</version>
</parent>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
- <version>2.17.1</version>
+ <version>2.17.2</version>
<name>jackson-databind</name>
<packaging>jar</packaging>
<description>General data-binding functionality for Jackson: works on core
streaming API</description>
@@ -31,7 +31,7 @@
<connection>scm:git:[email protected]:FasterXML/jackson-databind.git</connection>
<developerConnection>scm:git:[email protected]:FasterXML/jackson-databind.git</developerConnection>
<url>https://github.com/FasterXML/jackson-databind</url>
- <tag>jackson-databind-2.17.1</tag>
+ <tag>jackson-databind-2.17.2</tag>
</scm>
<properties>
@@ -68,7 +68,7 @@
<version.powermock>2.0.9</version.powermock>
<!-- for Reproducible Builds -->
-
<project.build.outputTimestamp>2024-05-05T01:59:41Z</project.build.outputTimestamp>
+
<project.build.outputTimestamp>2024-07-05T17:14:38Z</project.build.outputTimestamp>
</properties>
<dependencies>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/release-notes/CREDITS-2.x
new/jackson-databind-jackson-databind-2.17.2/release-notes/CREDITS-2.x
--- old/jackson-databind-jackson-databind-2.17.1/release-notes/CREDITS-2.x
2024-05-05 04:07:04.000000000 +0200
+++ new/jackson-databind-jackson-databind-2.17.2/release-notes/CREDITS-2.x
2024-07-05 19:15:02.000000000 +0200
@@ -1739,6 +1739,10 @@
leads to `InvalidDefinitionException`: Multiple fields representing property
(2.16.2)
+Guillaume Jardillier (Mugiwara84@github)
+ * Reported #4564: Possible 2.16.0 Enum-as-JSON-Object serialization regression
+ (2.16.3)
+
Muhammad Khalikov (mukham12@github)
* Contributed fix for #4209: Make
`BeanDeserializerModifier`/`BeanSerializerModifier`
implement `java.io.Serializable`
@@ -1771,3 +1775,12 @@
in `DeserializerCache` to avoid deadlock on pinning
(2.17.1)
+Peter Levart (plevart@github)
+ * Reported, contributed fix for #4575: StdDelegatingSerializer does not
consider
+ a Converter that may return null for a non-null input
+ (2.17.2)
+
+Susan Witts (susanw1@github)
+ * Reported #4607: `MismatchedInput`: No Object Id found for an instance of X
to
+ assign to property '@id'
+ (2.17.2)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/release-notes/VERSION-2.x
new/jackson-databind-jackson-databind-2.17.2/release-notes/VERSION-2.x
--- old/jackson-databind-jackson-databind-2.17.1/release-notes/VERSION-2.x
2024-05-05 04:07:04.000000000 +0200
+++ new/jackson-databind-jackson-databind-2.17.2/release-notes/VERSION-2.x
2024-07-05 19:15:02.000000000 +0200
@@ -6,7 +6,24 @@
2.18.0 (not yet released)
--
+2.17.2 (05-Jul-2024)
+
+#4561: Issues using jackson-databind 2.17.1 with Reactor
+ (reported by @wdallastella)
+#4575: StdDelegatingSerializer does not consider a Converter that may
+ return null for a non-null input
+ (reported, fix contributed by Peter L)
+#4577: Cannot deserialize value of type `java.math.BigDecimal` from
+ String "3." (not a valid representation)
+ (reported by @dmelisso)
+#4595: No way to explicitly disable wrapping in custom annotation processor
+ (reported by @SimonCockx)
+#4607: `MismatchedInput`: No Object Id found for an instance of X to
+ assign to property '@id'
+ (reported by Susan W)
+#4610: `DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS` does not work
when
+ used with Polymorphic type handling
+ (fix by Joo-Hyuk K)
2.17.1 (04-May-2024)
@@ -86,6 +103,14 @@
(suggested by András P)
- JUnit5 upgraded to 5.10.1
+2.16.3 (not yet released)
+
+#4564: Possible 2.16.0 Enum-as-JSON-Object serialization regression
+ (reported by Guillaume J)
+ (fix contributed by Joo-Hyuk K)
+#4581: Incompatible Constructor Parameter Type in `EnumDeserializer`
+ (reported by @Hunter-Lam)
+
2.16.2 (09-Mar-2024)
#4302: Problem deserializing some type of Enums when using
`PropertyNamingStrategy`
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java
---
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java
2024-05-05 04:07:04.000000000 +0200
+++
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java
2024-07-05 19:15:02.000000000 +0200
@@ -95,10 +95,17 @@
* fails, event that was not recognized or usable, which may be
* the same event as the one it pointed to upon call).
*<p>
- * Note that this method is never called for JSON null literal,
- * and thus deserializers need (and should) not check for it.
+ * <strong>Handling null values (JsonToken.VALUE_NULL)</strong>
+ * <br>
+ * : Note that this method is never called for the JSON {@code null}
literal to avoid
+ * every deserializer from having to handle null values. Instead, the
+ * {@link JsonDeserializer#getNullValue(DeserializationContext)} method
+ * is called to produce a null value. To influence null handling,
+ * custom deserializers should override
+ * {@link JsonDeserializer#getNullValue(DeserializationContext)}
+ * and usually also {@link JsonDeserializer#getNullAccessPattern()}.
*
- * @param p Parsed used for reading JSON content
+ * @param p Parser used for reading JSON content
* @param ctxt Context that can be used to access information about
* this deserialization activity.
*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/PropertyName.java
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/PropertyName.java
---
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/PropertyName.java
2024-05-05 04:07:04.000000000 +0200
+++
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/PropertyName.java
2024-07-05 19:15:02.000000000 +0200
@@ -82,6 +82,9 @@
return NO_NAME;
}
*/
+ // 22-Jun-2024, tatu: This is hopeful not problematic as marker
+ // value should only be provided by AnnotationIntrospector etc,
+ // but not stored in Deserializer/Serializer instances.
}
return this;
}
@@ -127,6 +130,10 @@
if (name2 == null) {
return name1;
}
+ // 22-Jun-2024, tatu: [databind#4595] Should not merge NO_NAME
+ if (name1 == NO_NAME) {
+ return name1;
+ }
String ns = _nonEmpty(name1._namespace, name2._namespace);
String simple = _nonEmpty(name1._simpleName, name2._simpleName);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializer.java
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializer.java
---
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializer.java
2024-05-05 04:07:04.000000000 +0200
+++
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializer.java
2024-07-05 19:15:02.000000000 +0200
@@ -363,6 +363,8 @@
final Object bean = _valueInstantiator.createUsingDefault(ctxt);
// [databind#631]: Assign current value, to be accessible by custom
deserializers
p.assignCurrentValue(bean);
+
+ // First: do we have native Object Ids (like YAML)?
if (p.canReadObjectId()) {
Object id = p.getObjectId();
if (id != null) {
@@ -370,9 +372,13 @@
}
}
// [databind#3838]: since 2.16 Uniform handling of missing objectId
- // only for the specific "empty JSON Object" case
- if (_objectIdReader != null &&
p.hasTokenId(JsonTokenId.ID_END_OBJECT)) {
- ctxt.reportUnresolvedObjectId(_objectIdReader, bean);
+ // only for the specific "empty JSON Object" case (and only for
non-Native
+ // Object Ids, see [databind#4607]
+ else if (_objectIdReader != null &&
p.hasTokenId(JsonTokenId.ID_END_OBJECT)) {
+ // [databind#4610]: check if we are to skip failure
+ if
(ctxt.isEnabled(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS)) {
+ ctxt.reportUnresolvedObjectId(_objectIdReader, bean);
+ }
}
if (_injectables != null) {
injectValues(ctxt, bean);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java
---
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java
2024-05-05 04:07:04.000000000 +0200
+++
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java
2024-07-05 19:15:02.000000000 +0200
@@ -41,7 +41,7 @@
/**
* We will also cache some dynamically constructed deserializers;
* specifically, ones that are expensive to construct.
- * This currently means bean, Enum and container deserializers.
+ * This currently means POJO, Enum and Container deserializers.
*/
protected final LookupCache<JavaType, JsonDeserializer<Object>>
_cachedDeserializers;
@@ -56,6 +56,9 @@
/**
* We hold an explicit lock while creating deserializers to avoid creating
duplicates.
+ * Guards {@link #_incompleteDeserializers}.
+ *
+ * @since 2.17
*/
private final ReentrantLock _incompleteDeserializersLock = new
ReentrantLock();
@@ -169,10 +172,9 @@
// If not, need to request factory to construct (or recycle)
deser = _createAndCacheValueDeserializer(ctxt, factory,
propertyType);
if (deser == null) {
- /* Should we let caller handle it? Let's have a helper method
- * decide it; can throw an exception, or return a valid
- * deserializer
- */
+ // Should we let caller handle it? Let's have a helper method
+ // decide it; can throw an exception, or return a valid
+ // deserializer
deser = _handleUnknownValueDeserializer(ctxt, propertyType);
}
}
@@ -211,9 +213,8 @@
DeserializerFactory factory, JavaType type)
throws JsonMappingException
{
- /* Note: mostly copied from findValueDeserializer, except for
- * handling of unknown types
- */
+ // Note: mostly copied from findValueDeserializer, except for
+ // handling of unknown types
JsonDeserializer<Object> deser = _findCachedDeserializer(type);
if (deser == null) {
deser = _createAndCacheValueDeserializer(ctxt, factory, type);
@@ -249,13 +250,11 @@
DeserializerFactory factory, JavaType type)
throws JsonMappingException
{
- /* Only one thread to construct deserializers at any given point in
time;
- * limitations necessary to ensure that only completely initialized
ones
- * are visible and used.
- */
+ // Only one thread to construct deserializers at any given point in
time;
+ // limitations necessary to ensure that only completely initialized
ones
+ // are visible and used.
+ _incompleteDeserializersLock.lock();
try {
- _incompleteDeserializersLock.lock();
-
// Ok, then: could it be that due to a race condition,
deserializer can now be found?
JsonDeserializer<Object> deser = _findCachedDeserializer(type);
if (deser != null) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java
---
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java
2024-05-05 04:07:04.000000000 +0200
+++
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java
2024-07-05 19:15:02.000000000 +0200
@@ -2,6 +2,7 @@
import java.io.IOException;
import java.util.Objects;
+import java.util.Optional;
import com.fasterxml.jackson.annotation.JsonFormat;
@@ -19,7 +20,6 @@
import com.fasterxml.jackson.databind.util.ClassUtil;
import com.fasterxml.jackson.databind.util.CompactStringObjectMap;
import com.fasterxml.jackson.databind.util.EnumResolver;
-import java.util.Optional;
/**
* Deserializer class that can deserialize instances of
@@ -83,7 +83,7 @@
@Deprecated
public EnumDeserializer(EnumResolver byNameResolver, Boolean
caseInsensitive)
{
- this(byNameResolver, caseInsensitive, null, null);
+ this(byNameResolver, Boolean.TRUE.equals(caseInsensitive), null);
}
/**
@@ -92,7 +92,7 @@
*/
@Deprecated
public EnumDeserializer(EnumResolver byNameResolver, boolean
caseInsensitive,
- EnumResolver byEnumNamingResolver)
+ EnumResolver byEnumNamingResolver)
{
super(byNameResolver.getEnumClass());
_lookupByName = byNameResolver.constructLookup();
@@ -108,7 +108,7 @@
* @since 2.16
*/
public EnumDeserializer(EnumResolver byNameResolver, boolean
caseInsensitive,
- EnumResolver byEnumNamingResolver, EnumResolver
toStringResolver)
+ EnumResolver byEnumNamingResolver, EnumResolver toStringResolver)
{
super(byNameResolver.getEnumClass());
_lookupByName = byNameResolver.constructLookup();
@@ -130,7 +130,7 @@
_lookupByName = base._lookupByName;
_enumsByIndex = base._enumsByIndex;
_enumDefaultValue = base._enumDefaultValue;
- _caseInsensitive = caseInsensitive;
+ _caseInsensitive = Boolean.TRUE.equals(caseInsensitive);
_isFromIntValue = base._isFromIntValue;
_useDefaultValueForUnknownEnum = useDefaultValueForUnknownEnum;
_useNullForUnknownEnum = useNullForUnknownEnum;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedFieldCollector.java
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedFieldCollector.java
---
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedFieldCollector.java
2024-05-05 04:07:04.000000000 +0200
+++
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedFieldCollector.java
2024-07-05 19:15:02.000000000 +0200
@@ -124,7 +124,8 @@
private boolean _isIncludableField(Field f)
{
- // [databind#2787]: Allow `Enum` mixins
+ // [databind#2787]: To allow `Enum` mixins, need to include Enum
constants even
+ // to they are static fields, not instance ones.
if (f.isEnumConstant()) {
return true;
}
@@ -132,10 +133,9 @@
if (f.isSynthetic()) {
return false;
}
- // Static fields are never included. Transient are (since 2.6), for
- // purpose of propagating removal
- int mods = f.getModifiers();
- if (Modifier.isStatic(mods)) {
+ // Static fields are never included (except for above-mentioned Enum
constants.
+ // Transient are (since 2.6), for purpose of propagating removal
+ if (Modifier.isStatic(f.getModifiers())) {
return false;
}
return true;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/introspect/POJOPropertyBuilder.java
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/introspect/POJOPropertyBuilder.java
---
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/introspect/POJOPropertyBuilder.java
2024-05-05 04:07:04.000000000 +0200
+++
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/introspect/POJOPropertyBuilder.java
2024-07-05 19:15:02.000000000 +0200
@@ -394,7 +394,7 @@
return (_ctorParameters != null)
|| (_setters != null)
|| ((_fields != null)
- // [databind#736] Since 2.16 : Fix
`REQUIRE_SETTERS_FOR_GETTERS` taking no effect
+ // [databind#736] Since 2.17: Fix
`REQUIRE_SETTERS_FOR_GETTERS` taking no effect
&& (_anyVisible(_fields)));
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/json/JsonMapper.java
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/json/JsonMapper.java
---
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/json/JsonMapper.java
2024-05-05 04:07:04.000000000 +0200
+++
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/json/JsonMapper.java
2024-07-05 19:15:02.000000000 +0200
@@ -118,7 +118,7 @@
return new Builder(new JsonMapper(streamFactory));
}
- public JsonMapper.Builder rebuild() {
+ public JsonMapper.Builder rebuild() {
// 09-Dec-2018, tatu: Not as good as what 3.0 has wrt immutability,
but best approximation
// we have for 2.x
return new Builder(this.copy());
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/ser/BasicSerializerFactory.java
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/ser/BasicSerializerFactory.java
---
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/ser/BasicSerializerFactory.java
2024-05-05 04:07:04.000000000 +0200
+++
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/ser/BasicSerializerFactory.java
2024-07-05 19:15:02.000000000 +0200
@@ -1208,7 +1208,7 @@
((BasicBeanDescription) beanDesc).removeProperty("declaringClass");
// [databind#2787]: remove self-referencing enum fields introduced
by annotation flattening of mixins
if (type.isEnumType()){
- _removeEnumSelfReferences(((BasicBeanDescription) beanDesc));
+ _removeEnumSelfReferences(beanDesc);
}
// returning null will mean that eventually BeanSerializer gets
constructed
return null;
@@ -1226,24 +1226,28 @@
}
/**
- * Helper method used for serialization {@link Enum} as {@link
JsonFormat.Shape#OBJECT}. Removes any
- * self-referencing properties from its bean description before it is
transformed into a JSON Object
- * as configured by {@link JsonFormat.Shape#OBJECT}.
+ * Helper method used for serialization {@link Enum} as {@link
JsonFormat.Shape#OBJECT}.
+ * Removes any self-referencing properties from its bean description
before it is
+ * transformed into a JSON Object as configured by {@link
JsonFormat.Shape#OBJECT}.
* <p>
- * Internally, this method iterates through {@link
BeanDescription#findProperties()} and removes self.
+ * Internally, this method iterates through {@link
BeanDescription#findProperties()}
+ * and removes self references.
*
* @param beanDesc the bean description to remove Enum properties from.
*
* @since 2.16
*/
- private void _removeEnumSelfReferences(BasicBeanDescription beanDesc) {
+ private void _removeEnumSelfReferences(BeanDescription beanDesc) {
Class<?> aClass = ClassUtil.findEnumType(beanDesc.getBeanClass());
Iterator<BeanPropertyDefinition> it =
beanDesc.findProperties().iterator();
while (it.hasNext()) {
BeanPropertyDefinition property = it.next();
JavaType propType = property.getPrimaryType();
// is the property a self-reference?
- if (propType.isEnumType() && propType.isTypeOrSubTypeOf(aClass)) {
+ if (propType.isEnumType() && propType.isTypeOrSubTypeOf(aClass)
+ // [databind#4564] Since 2.16.3, Enum's should allow self
as field, so let's remove only if static.
+ && property.getAccessor().isStatic())
+ {
it.remove();
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java
---
old/jackson-databind-jackson-databind-2.17.1/src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java
2024-05-05 04:07:04.000000000 +0200
+++
new/jackson-databind-jackson-databind-2.17.2/src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java
2024-07-05 19:15:02.000000000 +0200
@@ -174,6 +174,11 @@
// 03-Oct-2012, tatu: This is actually unlikely to work ok... but for
now,
// let's give it a chance?
Object delegateValue = convertValue(value);
+ // consider null (to be consistent with serialize method above)
+ if (delegateValue == null) {
+ provider.defaultSerializeNull(gen);
+ return;
+ }
JsonSerializer<Object> ser = _delegateSerializer;
if (ser == null) {
ser = _findSerializer(value, provider);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/test/java/com/fasterxml/jackson/databind/ObjectMapperTest.java
new/jackson-databind-jackson-databind-2.17.2/src/test/java/com/fasterxml/jackson/databind/ObjectMapperTest.java
---
old/jackson-databind-jackson-databind-2.17.1/src/test/java/com/fasterxml/jackson/databind/ObjectMapperTest.java
2024-05-05 04:07:04.000000000 +0200
+++
new/jackson-databind-jackson-databind-2.17.2/src/test/java/com/fasterxml/jackson/databind/ObjectMapperTest.java
2024-07-05 19:15:02.000000000 +0200
@@ -12,7 +12,7 @@
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.core.json.JsonWriteFeature;
import com.fasterxml.jackson.core.util.MinimalPrettyPrinter;
-
+import com.fasterxml.jackson.databind.cfg.EnumFeature;
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
import com.fasterxml.jackson.databind.introspect.VisibilityChecker;
import com.fasterxml.jackson.databind.json.JsonMapper;
@@ -268,6 +268,27 @@
}
/*
+ /**********************************************************
+ /* Test methods, JsonMapper.rebuild()
+ /**********************************************************
+ */
+
+ @Test
+ public void jsonMapperRebuildTest()
+ {
+ JsonMapper m = JsonMapper.builder().build();
+ JsonMapper m2 = m.copy();
+ assertNotSame(m, m2);
+
+ JsonMapper m3 = m2.rebuild()
+ .propertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE)
+ .enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS)
+ .enable(EnumFeature.WRITE_ENUMS_TO_LOWERCASE)
+ .build();
+ assertNotSame(m2, m3);
+ }
+
+ /*
/**********************************************************
/* Test methods, other
/**********************************************************
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/test/java/com/fasterxml/jackson/databind/deser/CustomDeserializers4225NullCacheTest.java
new/jackson-databind-jackson-databind-2.17.2/src/test/java/com/fasterxml/jackson/databind/deser/CustomDeserializers4225NullCacheTest.java
---
old/jackson-databind-jackson-databind-2.17.1/src/test/java/com/fasterxml/jackson/databind/deser/CustomDeserializers4225NullCacheTest.java
1970-01-01 01:00:00.000000000 +0100
+++
new/jackson-databind-jackson-databind-2.17.2/src/test/java/com/fasterxml/jackson/databind/deser/CustomDeserializers4225NullCacheTest.java
2024-07-05 19:15:02.000000000 +0200
@@ -0,0 +1,70 @@
+package com.fasterxml.jackson.databind.deser;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.jupiter.api.Test;
+
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.*;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.testutil.DatabindTestUtil;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Test to check that getNullValue for deserializer is not cached, by default.
+ */
+public class CustomDeserializers4225NullCacheTest extends DatabindTestUtil
+{
+ static class CustomListDeserializer extends JsonDeserializer<List<String>>
{
+
+ private static int getNullValueInvocationCount = 0;
+
+ @Override
+ public List<String> deserialize(JsonParser p, DeserializationContext
ctxt) throws IOException, JacksonException {
+ return makeList("regular");
+ }
+
+ @Override
+ public List<String> getNullValue(DeserializationContext ctxt) throws
JsonMappingException {
+ // Increment invocation count
+ getNullValueInvocationCount++;
+ return makeList("nullVal_" + getNullValueInvocationCount);
+ }
+
+ public List<String> makeList(String content) {
+ List<String> randomList = new ArrayList<>();
+ randomList.add(content);
+ return randomList;
+ }
+ }
+
+ static class Bean4225 {
+ @JsonDeserialize(using = CustomListDeserializer.class)
+ public List<String> myList;
+ }
+
+ @Test
+ public void testGetNullValueIsCached() throws Exception
+ {
+ ObjectMapper mapper = newJsonMapper();
+
+ // First time deserializing null
+ verifyGetNullValueInvokedTimes(mapper, 1);
+ // Second time deserializing null, should be invoked twice
+ verifyGetNullValueInvokedTimes(mapper, 2);
+ }
+
+ private void verifyGetNullValueInvokedTimes(ObjectMapper mapper, int times)
+ throws Exception
+ {
+ Bean4225 someBean = mapper.readValue(a2q("{'myList': null}"),
Bean4225.class);
+
+ assertThat(someBean.myList).hasSize(1);
+ assertThat(someBean.myList.get(0)).isEqualTo("nullVal_" + times);
+
assertThat(CustomListDeserializer.getNullValueInvocationCount).isEqualTo(times);
+ }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/test/java/com/fasterxml/jackson/databind/deser/jdk/BigNumbersDeserTest.java
new/jackson-databind-jackson-databind-2.17.2/src/test/java/com/fasterxml/jackson/databind/deser/jdk/BigNumbersDeserTest.java
---
old/jackson-databind-jackson-databind-2.17.1/src/test/java/com/fasterxml/jackson/databind/deser/jdk/BigNumbersDeserTest.java
2024-05-05 04:07:04.000000000 +0200
+++
new/jackson-databind-jackson-databind-2.17.2/src/test/java/com/fasterxml/jackson/databind/deser/jdk/BigNumbersDeserTest.java
2024-07-05 19:15:02.000000000 +0200
@@ -104,29 +104,25 @@
// [databind#4435]
@Test
- public void testNumberStartingWithDot() throws Exception
- {
- String num = ".555555555555555555555555555555";
- BigDecimalWrapper w = MAPPER.readValue("{\"number\":\"" + num + "\"}",
BigDecimalWrapper.class);
- assertEquals(new BigDecimal(num), w.number);
+ public void testNumberStartingWithDot() throws Exception {
+ _testNumberWith(".555555555555555555555555555555");
+ _testNumberWith("-.555555555555555555555555555555");
+ _testNumberWith("+.555555555555555555555555555555");
}
- // [databind#4435]
+ // [databind#4577]
@Test
- public void testNumberStartingWithMinusDot() throws Exception
- {
- String num = "-.555555555555555555555555555555";
- BigDecimalWrapper w = MAPPER.readValue("{\"number\":\"" + num + "\"}",
BigDecimalWrapper.class);
- assertEquals(new BigDecimal(num), w.number);
+ public void testNumberEndingWithDot() throws Exception {
+ _testNumberWith("55.");
+ _testNumberWith("-55.");
+ _testNumberWith("+55.");
}
-
- // [databind#4435]
- @Test
- public void testNumberStartingWithPlusDot() throws Exception
+
+ private void _testNumberWith(String num) throws Exception
{
- String num = "+.555555555555555555555555555555";
+ BigDecimal exp = new BigDecimal(num);
BigDecimalWrapper w = MAPPER.readValue("{\"number\":\"" + num + "\"}",
BigDecimalWrapper.class);
- assertEquals(new BigDecimal(num), w.number);
+ assertEquals(exp, w.number);
}
private String generateJson(final String fieldName) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/test/java/com/fasterxml/jackson/databind/introspect/IntrospectorPairTest.java
new/jackson-databind-jackson-databind-2.17.2/src/test/java/com/fasterxml/jackson/databind/introspect/IntrospectorPairTest.java
---
old/jackson-databind-jackson-databind-2.17.1/src/test/java/com/fasterxml/jackson/databind/introspect/IntrospectorPairTest.java
2024-05-05 04:07:04.000000000 +0200
+++
new/jackson-databind-jackson-databind-2.17.2/src/test/java/com/fasterxml/jackson/databind/introspect/IntrospectorPairTest.java
2024-07-05 19:15:02.000000000 +0200
@@ -209,6 +209,17 @@
/*
/******************************************************
+ /* General member (field, method/constructor) annotations
+ /******************************************************
+ */
+
+ @Override
+ public PropertyName findWrapperName(Annotated ann) {
+ return (PropertyName) values.get("findWrapperName");
+ }
+
+ /*
+ /******************************************************
/* Serialization introspection
/******************************************************
*/
@@ -388,6 +399,42 @@
/*
/**********************************************************
+ /* Test methods, general member annotations
+ /**********************************************************
+ */
+
+ @Test
+ public void testFindWrapperName() throws Exception
+ {
+ final PropertyName NAME_WITH_NS = PropertyName.construct("simple",
"ns");
+ final PropertyName NAME_NO_NS = PropertyName.construct("other", null);
+
+ assertNull(new AnnotationIntrospectorPair(NO_ANNOTATIONS,
NO_ANNOTATIONS)
+ .findClassDescription(null));
+
+ // First: basic merging of namespace/localname info
+ IntrospectorWithMap intr1 = new IntrospectorWithMap()
+ .add("findWrapperName", NAME_WITH_NS);
+ IntrospectorWithMap intr2 = new IntrospectorWithMap()
+ .add("findWrapperName", NAME_NO_NS);
+ assertSame(NAME_WITH_NS,
+ new AnnotationIntrospectorPair(intr1,
intr2).findWrapperName(null));
+ assertEquals(PropertyName.construct("other", "ns"),
+ new AnnotationIntrospectorPair(intr2,
intr1).findWrapperName(null));
+
+ // [databind#4595]: NO_NAME should be retained, not merged
+ intr1 = new IntrospectorWithMap()
+ .add("findWrapperName", PropertyName.NO_NAME);
+ intr2 = new IntrospectorWithMap()
+ .add("findWrapperName", NAME_WITH_NS);
+ assertSame(PropertyName.NO_NAME,
+ new AnnotationIntrospectorPair(intr1,
intr2).findWrapperName(null));
+ assertSame(NAME_WITH_NS,
+ new AnnotationIntrospectorPair(intr2,
intr1).findWrapperName(null));
+ }
+
+ /*
+ /**********************************************************
/* Test methods, ser/deser
/**********************************************************
*/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectIdSubTypes4610Test.java
new/jackson-databind-jackson-databind-2.17.2/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectIdSubTypes4610Test.java
---
old/jackson-databind-jackson-databind-2.17.1/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectIdSubTypes4610Test.java
1970-01-01 01:00:00.000000000 +0100
+++
new/jackson-databind-jackson-databind-2.17.2/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectIdSubTypes4610Test.java
2024-07-05 19:15:02.000000000 +0200
@@ -0,0 +1,76 @@
+package com.fasterxml.jackson.databind.objectid;
+
+import java.util.List;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import com.fasterxml.jackson.annotation.*;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.testutil.DatabindTestUtil;
+
+import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class ObjectIdSubTypes4610Test extends DatabindTestUtil
+{
+ // Unused @JsonIdentityInfo
+ @JsonIdentityInfo(generator = ObjectIdGenerators.StringIdGenerator.class)
+ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME)
+ @JsonSubTypes({
+ @JsonSubTypes.Type(value = EnumTypeDefinition.class, name =
"enum"),
+ @JsonSubTypes.Type(value = NumberTypeDefinition.class, name =
"number")
+ })
+ interface TypeDefinition {
+ }
+
+ static class EnumTypeDefinition implements TypeDefinition {
+ public List<String> values;
+ }
+
+ static class NumberTypeDefinition implements TypeDefinition {
+ }
+
+ private final ObjectMapper MAPPER = newJsonMapper();
+
+ @Test
+ public void shouldHandleTypeDefinitionJson() throws Exception {
+ String input = "{\"@type\": \"number\"}";
+
+ TypeDefinition model = MAPPER.readerFor(TypeDefinition.class)
+ .without(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS)
+ .readValue(input);
+
+ Assertions.assertInstanceOf(NumberTypeDefinition.class, model);
+ }
+
+ @Test
+ public void testRoundTrip() throws Exception {
+ // Ser
+ String JSON = MAPPER.writeValueAsString(new NumberTypeDefinition());
+ assertTrue(JSON.contains("@id"));
+
+ // Deser
+ TypeDefinition model = MAPPER.readerFor(TypeDefinition.class)
+ .with(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS)
+ .readValue(JSON);
+ Assertions.assertInstanceOf(NumberTypeDefinition.class, model);
+ }
+
+ @Test
+ public void shouldHandleTypeDefinitionJsonFail() throws Exception {
+ String JSON = "{\"@type\": \"number\"}";
+
+ try {
+ /*TypeDefinition model =*/ MAPPER.readerFor(TypeDefinition.class)
+ .with(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS)
+ .readValue(JSON);
+ fail("Should not pass");
+ } catch (Exception e) {
+ assertTrue(e.getMessage().startsWith("No Object Id found for an
instance of"));
+ }
+ }
+}
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/test/java/com/fasterxml/jackson/databind/ser/TestCustomSerializers.java
new/jackson-databind-jackson-databind-2.17.2/src/test/java/com/fasterxml/jackson/databind/ser/TestCustomSerializers.java
---
old/jackson-databind-jackson-databind-2.17.1/src/test/java/com/fasterxml/jackson/databind/ser/TestCustomSerializers.java
2024-05-05 04:07:04.000000000 +0200
+++
new/jackson-databind-jackson-databind-2.17.2/src/test/java/com/fasterxml/jackson/databind/ser/TestCustomSerializers.java
2024-07-05 19:15:02.000000000 +0200
@@ -8,9 +8,7 @@
import org.w3c.dom.Element;
-import com.fasterxml.jackson.annotation.JsonFilter;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.core.io.CharacterEscapes;
@@ -23,6 +21,8 @@
import com.fasterxml.jackson.databind.ser.std.CollectionSerializer;
import com.fasterxml.jackson.databind.ser.std.StdDelegatingSerializer;
import com.fasterxml.jackson.databind.ser.std.StdScalarSerializer;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+import com.fasterxml.jackson.databind.util.Converter;
import com.fasterxml.jackson.databind.util.StdConverter;
/**
@@ -187,6 +187,55 @@
}
}
+ // [databind#4575]
+ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "@type")
+ @JsonSubTypes(
+ {
+ @JsonSubTypes.Type(Sub4575.class)
+ }
+ )
+ @JsonTypeName("Super")
+ static class Super4575 {
+ public static final Super4575 NULL = new Super4575();
+ }
+
+ @JsonTypeName("Sub")
+ static class Sub4575 extends Super4575 { }
+
+ static class NullSerializer4575 extends StdDelegatingSerializer {
+ public NullSerializer4575(Converter<Object, ?> converter, JavaType
delegateType, JsonSerializer<?> delegateSerializer) {
+ super(converter, delegateType, delegateSerializer);
+ }
+
+ public NullSerializer4575(TypeFactory typeFactory, JsonSerializer<?>
delegateSerializer) {
+ this(
+ new Converter<Object, Object>() {
+ @Override
+ public Object convert(Object value) {
+ return value == Super4575.NULL ? null : value;
+ }
+
+ @Override
+ public JavaType getInputType(TypeFactory typeFactory) {
+ return
typeFactory.constructType(delegateSerializer.handledType());
+ }
+
+ @Override
+ public JavaType getOutputType(TypeFactory typeFactory) {
+ return
typeFactory.constructType(delegateSerializer.handledType());
+ }
+ },
+ typeFactory.constructType(delegateSerializer.handledType() ==
null ? Object.class : delegateSerializer.handledType()),
+ delegateSerializer
+ );
+ }
+
+ @Override
+ protected StdDelegatingSerializer withDelegate(Converter<Object, ?>
converter, JavaType delegateType, JsonSerializer<?> delegateSerializer) {
+ return new NullSerializer4575(converter, delegateType,
delegateSerializer);
+ }
+ }
+
/*
/**********************************************************
/* Unit tests
@@ -208,7 +257,6 @@
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testCustomLists() throws Exception
{
- ObjectMapper mapper = new ObjectMapper();
SimpleModule module = new SimpleModule("test",
Version.unknownVersion());
JsonSerializer<?> ser = new CollectionSerializer(null, false, null,
null);
final JsonSerializer<Object> collectionSerializer =
(JsonSerializer<Object>) ser;
@@ -225,14 +273,15 @@
}
}
});
- mapper.registerModule(module);
+ ObjectMapper mapper = jsonMapperBuilder()
+ .addModule(module)
+ .build();
assertEquals("null", mapper.writeValueAsString(new
ArrayList<Object>()));
}
// [databind#87]: delegating serializer
public void testDelegating() throws Exception
{
- ObjectMapper mapper = new ObjectMapper();
SimpleModule module = new SimpleModule("test",
Version.unknownVersion());
module.addSerializer(new StdDelegatingSerializer(Immutable.class,
new StdConverter<Immutable, Map<String,Integer>>() {
@@ -245,7 +294,9 @@
return map;
}
}));
- mapper.registerModule(module);
+ ObjectMapper mapper = jsonMapperBuilder()
+ .addModule(module)
+ .build();
assertEquals("{\"x\":3,\"y\":7}", mapper.writeValueAsString(new
Immutable()));
}
@@ -279,8 +330,9 @@
SimpleModule module = new SimpleModule("test",
Version.unknownVersion());
module.addSerializer(String.class, new UCStringSerializer());
- ObjectMapper mapper = new ObjectMapper()
- .registerModule(module);
+ ObjectMapper mapper = jsonMapperBuilder()
+ .addModule(module)
+ .build();
assertEquals(q("FOOBAR"), mapper.writeValueAsString("foobar"));
assertEquals(a2q("['FOO',null]"),
@@ -306,4 +358,28 @@
assertEquals(a2q("{'id':'ID-2','set':[]}"),
writer.writeValueAsString(new Item2475(new HashSet<String>(),
"ID-2")));
}
+
+ // [databind#4575]
+ public void testIssue4575() throws Exception {
+ com.fasterxml.jackson.databind.Module module = new SimpleModule() {
+ {
+ setSerializerModifier(new BeanSerializerModifier() {
+ @Override
+ public JsonSerializer<?> modifySerializer(
+ SerializationConfig config, BeanDescription beanDesc,
JsonSerializer<?> serializer
+ ) {
+ return new NullSerializer4575(config.getTypeFactory(),
serializer);
+ }
+ });
+ }
+ };
+
+ ObjectMapper mapper = jsonMapperBuilder()
+ .addModule(module)
+ .build();
+
+ assertEquals("{\"@type\":\"Super\"}", mapper.writeValueAsString(new
Super4575()));
+ assertEquals("{\"@type\":\"Sub\"}", mapper.writeValueAsString(new
Sub4575()));
+ assertEquals("null", mapper.writeValueAsString(Super4575.NULL));
+ }
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/test/java/com/fasterxml/jackson/databind/ser/enums/EnumAsFormatObject4564Test.java
new/jackson-databind-jackson-databind-2.17.2/src/test/java/com/fasterxml/jackson/databind/ser/enums/EnumAsFormatObject4564Test.java
---
old/jackson-databind-jackson-databind-2.17.1/src/test/java/com/fasterxml/jackson/databind/ser/enums/EnumAsFormatObject4564Test.java
1970-01-01 01:00:00.000000000 +0100
+++
new/jackson-databind-jackson-databind-2.17.2/src/test/java/com/fasterxml/jackson/databind/ser/enums/EnumAsFormatObject4564Test.java
2024-07-05 19:15:02.000000000 +0200
@@ -0,0 +1,61 @@
+package com.fasterxml.jackson.databind.ser.enums;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.json.JsonMapper;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+// [databind#4564] Fix Enum-asJSON-Object serialization with self as field.
+public class EnumAsFormatObject4564Test
+{
+
+ @JsonFormat(shape = JsonFormat.Shape.OBJECT)
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ public enum Level {
+ LEVEL1("level1"),
+ LEVEL2("level2"),
+ LEVEL3("level3", Level.LEVEL1);
+
+ public String label;
+ public Level sublevel;
+
+ Level(String level2) {
+ this.label = level2;
+ }
+
+ Level(String level3, Level level) {
+ this.label = level3;
+ this.sublevel = level;
+ }
+ }
+
+ private final ObjectMapper MAPPER = new JsonMapper();
+
+ @Test
+ public void testEnumAsFormatObject() throws JsonProcessingException {
+ List<Level> levels = new ArrayList<>();
+ levels.add(Level.LEVEL1);
+ levels.add(Level.LEVEL2);
+ levels.add(Level.LEVEL3);
+
+ String JSON = MAPPER.writerFor(new TypeReference<List<Level>>() {
+ }).writeValueAsString(levels);
+
+ // Fails, because we get
[{"label":"level1"},{"label":"level2"},{"label":"level3"}]
+ assertEquals(
+ "["
+ + "{\"label\":\"level1\"},"
+ + "{\"label\":\"level2\"},"
+ +
"{\"label\":\"level3\",\"sublevel\":{\"label\":\"level1\"}}"
+ + "]",
+ JSON);
+ }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/jackson-databind-jackson-databind-2.17.1/src/test/java/com/fasterxml/jackson/failing/DeserializerUpdateProperties4358Test.java
new/jackson-databind-jackson-databind-2.17.2/src/test/java/com/fasterxml/jackson/failing/DeserializerUpdateProperties4358Test.java
---
old/jackson-databind-jackson-databind-2.17.1/src/test/java/com/fasterxml/jackson/failing/DeserializerUpdateProperties4358Test.java
2024-05-05 04:07:04.000000000 +0200
+++
new/jackson-databind-jackson-databind-2.17.2/src/test/java/com/fasterxml/jackson/failing/DeserializerUpdateProperties4358Test.java
1970-01-01 01:00:00.000000000 +0100
@@ -1,172 +0,0 @@
-package com.fasterxml.jackson.failing;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import com.fasterxml.jackson.core.JacksonException;
-import com.fasterxml.jackson.core.JsonParser;
-
-import com.fasterxml.jackson.databind.BaseMapTest;
-import com.fasterxml.jackson.databind.BeanDescription;
-import com.fasterxml.jackson.databind.DeserializationConfig;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.deser.BeanDeserializerModifier;
-import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-
-public class DeserializerUpdateProperties4358Test extends BaseMapTest {
-
- static class MutableBean {
-
- @JsonDeserialize(using = OrderingDeserializer.class)
- public String a;
- @JsonDeserialize(using = OrderingDeserializer.class)
- public String b;
-
- public String getA() {
- return a;
- }
-
- public void setA(String a) {
- this.a = a;
- }
-
- public String getB() {
- return b;
- }
-
- public void setB(String b) {
- this.b = b;
- }
- }
-
- static class ImmutableBean {
-
- @JsonDeserialize(using = OrderingDeserializer.class)
- public final String a;
- @JsonDeserialize(using = OrderingDeserializer.class)
- public final String b;
-
- @JsonCreator
- public ImmutableBean(@JsonProperty("a") String a, @JsonProperty("b")
String b) {
- this.a = a;
- this.b = b;
- }
-
- public String getA() {
- return a;
- }
-
- public String getB() {
- return b;
- }
- }
-
- static SimpleModule getSimpleModuleWithDeserializerModifier() {
- return new SimpleModule().setDeserializerModifier(new
BeanDeserializerModifier() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public List<BeanPropertyDefinition>
updateProperties(DeserializationConfig config, BeanDescription beanDesc,
- List<BeanPropertyDefinition> propDefs) {
- List<BeanPropertyDefinition> newPropDefs = new
ArrayList<>(propDefs.size());
- for (BeanPropertyDefinition propDef : propDefs) {
- if (propDef.getName().equals("b")) {
- newPropDefs.add(0, propDef);
- } else {
- newPropDefs.add(propDef);
- }
- }
- return newPropDefs;
- }
- });
- }
-
- static final List<String> actualOrder = new CopyOnWriteArrayList<>();
-
- static class OrderingDeserializer extends JsonDeserializer<String> {
-
- @Override
- public String deserialize(JsonParser p, DeserializationContext ctxt)
throws IOException, JacksonException {
- String value = p.getValueAsString();
- actualOrder.add(value);
- return value;
- }
- }
-
- final ObjectMapper stdObjectMapper = jsonMapperBuilder().build();
-
- final ObjectMapper modifiedObjectMapper =
jsonMapperBuilder().addModules(getSimpleModuleWithDeserializerModifier()).build();
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- actualOrder.clear();
- }
-
- // Succeeds
- public void testMutableBeanStandard() throws Exception {
- MutableBean recreatedBean = stdObjectMapper.readValue("{\"a\": \"A\",
\"b\": \"B\"}", MutableBean.class);
-
- assertEquals("A", recreatedBean.getA());
- assertEquals("B", recreatedBean.getB());
- assertEquals(Arrays.asList("A", "B"), actualOrder);
- }
-
- // Succeeds
- public void testImmutableBeanStandard() throws Exception {
- ImmutableBean recreatedBean = stdObjectMapper.readValue("{\"a\":
\"A\", \"b\": \"B\"}", ImmutableBean.class);
-
- assertEquals("A", recreatedBean.getA());
- assertEquals("B", recreatedBean.getB());
- assertEquals(Arrays.asList("A", "B"), actualOrder);
- }
-
- // Fails - shall the order in the content really define the
deserialization order? Probably not the most critical thing,
- // but may create subtitle issues with interdependencies.
- public void testMutableBeanReversedInputStandard() throws Exception {
- MutableBean recreatedBean = stdObjectMapper.readValue("{\"b\": \"B\",
\"a\": \"A\"}", MutableBean.class);
-
- assertEquals("A", recreatedBean.getA());
- assertEquals("B", recreatedBean.getB());
- assertEquals(Arrays.asList("A", "B"), actualOrder);
- }
-
- // Fails - shall the order in the content really define the
deserialization order? Probably not the most critical thing,
- // but may create subtitle issues with interdependencies.
- public void testImmutableBeanReversedInputStandard() throws Exception {
- ImmutableBean recreatedBean = stdObjectMapper.readValue("{\"b\":
\"B\", \"a\": \"A\"}", ImmutableBean.class);
-
- assertEquals("A", recreatedBean.getA());
- assertEquals("B", recreatedBean.getB());
- assertEquals(Arrays.asList("A", "B"), actualOrder);
- }
-
- // Shall succeed - note that the setters are called in the same order as
the deserializers.
- public void testMutableBeanUpdateOrderBuilder() throws Exception {
- MutableBean recreatedBean = modifiedObjectMapper.readValue("{\"a\":
\"A\", \"b\": \"B\"}", MutableBean.class);
-
- assertEquals("A", recreatedBean.getA());
- assertEquals("B", recreatedBean.getB());
- assertEquals(Arrays.asList("B", "A"), actualOrder);
- }
-
- // Shall succeed
- public void testImmutableBeanUpdateOrderBuilder() throws Exception {
- ImmutableBean recreatedBean = modifiedObjectMapper.readValue("{\"a\":
\"A\", \"b\": \"B\"}", ImmutableBean.class);
-
- assertEquals("A", recreatedBean.getA());
- assertEquals("B", recreatedBean.getB());
- assertEquals(Arrays.asList("B", "A"), actualOrder);
- }
-}
++++++ jackson-databind-build.xml ++++++
--- /var/tmp/diff_new_pack.m5LQnB/_old 2024-08-14 14:15:33.554315632 +0200
+++ /var/tmp/diff_new_pack.m5LQnB/_new 2024-08-14 14:15:33.558315800 +0200
@@ -11,7 +11,7 @@
<property name="project.groupId" value="com.fasterxml.jackson.core"/>
<property name="project.artifactId" value="jackson-databind"/>
<property name="project.name" value="jackson-databind"/>
- <property name="project.version" value="2.17.1"/>
+ <property name="project.version" value="2.17.2"/>
<property name="project.vendor" value="FasterXML"/>
<property name="project.description" value="General data-binding
functionality for Jackson: works on core streaming API"/>
<property name="bundle.version" value="${project.version}"/>