Skip to content

Commit 63b33fb

Browse files
committed
Fix #647
1 parent b1d3406 commit 63b33fb

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

release-notes/CREDITS

+5
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,8 @@ Michael Ressler (mressler@github)
183183
* Contributed #566: Add support for case-insensitive deserialization
184184
(`MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES`)
185185
(2.5.0)
186+
187+
Konstantin Labun (kulabun@github)
188+
* Reported #647: Deserialization fails when @JsonUnwrapped property contains an object with same property name
189+
(2.5.0)
190+

release-notes/VERSION

+3-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ Project: jackson-databind
5858
#636: `ClassNotFoundException` for classes not (yet) needed during serialization
5959
(contributed by mspiegel@github)
6060
#638: Add annotation-based method(s) for injecting properties during serialization
61-
(using @JsonAppend, VirtualBeanPropertyWriter)
61+
(using @JsonAppend, VirtualBeanPropertyWriter)
62+
#647: Deserialization fails when @JsonUnwrapped property contains an object with same property name
63+
(reported by Konstantin L)
6264
- Allow use of `Shape.ARRAY` for Enums, as an alias to 'use index'
6365
- Start using `JsonGenerator.writeStartArray(int)` to help data formats
6466
that benefit from knowing number of elements in arrays (and would otherwise

src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBase.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,10 @@ public void resolve(DeserializationContext ctxt)
461461
unwrapped = new UnwrappedPropertyHandler();
462462
}
463463
unwrapped.addProperty(prop);
464-
// 10-Apr-2014, tatu: Looks like we should also do this? (no observed diff tho)
465-
if (prop != origProp) {
466-
_beanProperties.replace(prop);
467-
}
464+
/* 12-Dec-2014, tatu: As per [databind#647], we will have problems if
465+
* the original property is left in place. So let's remove it now.
466+
*/
467+
_beanProperties.remove(prop);
468468
continue;
469469
}
470470
// [JACKSON-594]: non-static inner classes too:

src/test/java/com/fasterxml/jackson/failing/TestUnwrappedWithSameName647.java renamed to src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrappedWithSameName647.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.fasterxml.jackson.failing;
1+
package com.fasterxml.jackson.databind.struct;
22

33
import com.fasterxml.jackson.annotation.JsonUnwrapped;
44
import com.fasterxml.jackson.databind.*;

0 commit comments

Comments
 (0)