Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public String deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx
}
// allow coercions for other scalar types
String text = p.getValueAsString();
if (text != null) {
// According to [databind#742], StringDeserializer shouldn't throw an exception if the value of the property is null
if (text != null || JsonToken.VALUE_NULL.equals(p.getCurrentToken())) {
return text;
}
throw ctxt.mappingException(_valueClass, p.getCurrentToken());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,4 +466,31 @@ public void testNullObjectId() throws Exception
assertNotNull(value);
assertEquals(3, value.value);
}

//for databind#1150
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
static class IdentifiableStringId
{
public String id;
public int value;

public Identifiable next;

public IdentifiableStringId() { this(0); }
public IdentifiableStringId(int v) {
value = v;
}
}

public void testNullStringPropertyId() throws Exception
{


IdentifiableStringId value = MAPPER.readValue
(aposToQuotes("{'value':3, 'next':null, 'id':null}"), IdentifiableStringId.class);
assertNotNull(value);
assertEquals(3, value.value);
}


}