Skip to content

Commit

Permalink
Backport #703 fix by Francisco
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Feb 13, 2015
1 parent bff35ba commit 195e9b5
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
8 changes: 8 additions & 0 deletions release-notes/CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,11 @@ Ludevik@github:
Antibrumm@github:
* Reported #691: Jackson 2.5.0. NullSerializer for MapProperty failing
(2.5.2)

Shumpei Akai (flexfrank@github)
* Reported #703: Multiple calls to ObjectMapper#canSerialize(Object.class) returns different values
(2.5.2)

Francisco A. Lozano (flozano@github)
* Contributed fix for #703 (see above)
(2.5.2)
2 changes: 2 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Project: jackson-databind

#691: NullSerializer for MapProperty failing when using polymorphic handling
(reported by Antibrumm@github)
#703: Multiple calls to ObjectMapper#canSerialize(Object.class) returns different values
(reported by flexfrank@github)

2.5.1 (06-Feb-2015)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1087,16 +1087,16 @@ protected JsonSerializer<Object> _findExplicitUntypedSerializer(Class<?> runtime
ser = _serializerCache.untypedValueSerializer(runtimeType);
if (ser == null) {
ser = _createAndCacheUntypedSerializer(runtimeType);
/* 18-Sep-2014, tatu: This is unfortunate patch over related change
* that pushes creation of "unknown type" serializer deeper down
* in BeanSerializerFactory; as a result, we need to "undo" creation
* here.
*/
if (isUnknownTypeSerializer(ser)) {
return null;
}
}
}
/* 18-Sep-2014, tatu: This is unfortunate patch over related change
* that pushes creation of "unknown type" serializer deeper down
* in BeanSerializerFactory; as a result, we need to "undo" creation
* here.
*/
if (isUnknownTypeSerializer(ser)) {
return null;
}
return ser;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,13 @@ public void testAnnotationIntrospectorCopyin()
assertEquals(MyAnnotationIntrospector.class,
m2.getSerializationConfig().getAnnotationIntrospector().getClass());
}

// For [databind#703]
public void testNonSerializabilityOfObject()
{
ObjectMapper m = new ObjectMapper();
assertFalse(m.canSerialize(Object.class));
// but this used to pass, incorrectly
assertFalse(m.canSerialize(Object.class));
}
}

0 comments on commit 195e9b5

Please sign in to comment.