Skip to content

Commit 1971732

Browse files
committed
Fix #1533: Respect ACCEPT_EMPTY_STRING_AS_NULL_OBJECT for polymorphism.
1 parent ce37efc commit 1971732

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main/java/com/fasterxml/jackson/databind/jsontype/impl/AsPropertyTypeDeserializer.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ protected Object _deserializeTypedUsingDefaultImpl(JsonParser p, Deserialization
153153
// or, something for which "as-property" won't work, changed into "wrapper-array" type:
154154
if (p.getCurrentToken() == JsonToken.START_ARRAY) {
155155
return super.deserializeTypedFromAny(p, ctxt);
156+
} else if (p.getCurrentToken() == JsonToken.VALUE_STRING) {
157+
if (ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)) {
158+
String str = p.getText().trim();
159+
if (str.isEmpty()) {
160+
return null;
161+
}
162+
}
156163
}
157164
ctxt.reportWrongTokenException(p, JsonToken.FIELD_NAME,
158165
"missing property '"+_typePropertyName+"' that is to contain type id (for class "+baseTypeName()+")");

0 commit comments

Comments
 (0)