Skip to content

Commit e5ba603

Browse files
authored
Fix #4807: improve FactoryBasedEnumDeserializer handling of Object values (#4809)
1 parent 47e0736 commit e5ba603

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

release-notes/VERSION-2.x

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Project: jackson-databind
2424
#4790: Fix `@JsonAnySetter` issue with "setter" method (related to #4639)
2525
(reported by @bsa01)
2626
(fix by Joo-Hyuk K)
27+
#4807: Improve `FactoryBasedEnumDeserializer` to work better with XML module
2728

2829
2.18.1 (28-Oct-2024)
2930

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,11 @@ public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx
165165
if (unwrapping) {
166166
t = p.nextToken();
167167
}
168-
if ((t == null) || !t.isScalarValue()) {
168+
// 24-Nov-2024, tatu: New! "Scalar from Object" (mostly for XML) -- see
169+
// https://github.com/FasterXML/jackson-databind/issues/4807
170+
if (t == JsonToken.START_OBJECT) {
171+
value = ctxt.extractScalarFromObject(p, this, _valueClass);
172+
} else if ((t == null) || !t.isScalarValue()) {
169173
// Could argue we should throw an exception but...
170174
// 01-Jun-2023, tatu: And now we will finally do it!
171175
final JavaType targetType = getValueType(ctxt);

0 commit comments

Comments
 (0)