Skip to content

Commit e0fd026

Browse files
committed
Fix for jackson-dataformat-xml/460 issue: Collections should allow coercion from blank String (if enabled)
1 parent e237bca commit e0fd026

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/java/com/fasterxml/jackson/databind/deser/std/CollectionDeserializer.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ protected Collection<Object> _deserializeFromString(JsonParser p, Deserializatio
302302
// Start by verifying if we got empty/blank string since accessing
303303
// CoercionAction may be costlier than String value we'll almost certainly
304304
// need anyway
305-
if (value.isEmpty()) { // ... in future may want to allow blank, too?
305+
if (value.isEmpty()) {
306306
CoercionAction act = ctxt.findCoercionAction(logicalType(), rawTargetType,
307307
CoercionInputShape.EmptyString);
308308
act = _checkCoercionFail(ctxt, act, rawTargetType, value,
@@ -315,6 +315,14 @@ protected Collection<Object> _deserializeFromString(JsonParser p, Deserializatio
315315
p, ctxt, act, rawTargetType, "empty String (\"\")");
316316
}
317317
}
318+
// 26-Mar-2021, tatu: Some day is today; as per [dataformat-xml#460],
319+
// we do need to support blank String too...
320+
else if (_isBlank(value)) {
321+
final CoercionAction act = ctxt.findCoercionFromBlankString(logicalType(), rawTargetType,
322+
CoercionAction.Fail);
323+
return (Collection<Object>) _deserializeFromEmptyString(
324+
p, ctxt, act, rawTargetType, "blank String (all whitespace)");
325+
}
318326
return handleNonArray(p, ctxt, createDefaultInstance(ctxt));
319327
}
320328

0 commit comments

Comments
 (0)