Skip to content

Commit a2a86c2

Browse files
committed
Add release notes wrt #3655
1 parent 7c0a74e commit a2a86c2

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

release-notes/CREDITS-2.x

+8
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ Jonas Konrad (yawkat@github)
409409
* Contributed #3417: Allow (de)serializing records using Bean(De)SerializerModifier
410410
even when reflection is unavailable
411411
(2.14.0)
412+
* Contributed fix for #3655: `Enum` values can not be read from single-element array even
413+
with `DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS`
414+
(2.14.1)
412415
413416
Jirka Kremser (Jiri-Kremser@github)
414417
* Suggested #924: SequenceWriter.writeAll() could accept Iterable
@@ -1512,3 +1515,8 @@ Joachim Durchholz (toolforger@github)
15121515
* Requested #3633: Expose `translate()` method of standard `PropertyNamingStrategy`
15131516
implementations
15141517
(2.14.0)
1518+
1519+
Andrej Mitrovic (AndrejMitrovic@github)
1520+
* Reported #3655: `Enum` values can not be read from single-element array even with
1521+
`DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS`
1522+
(2.14.1)

release-notes/VERSION-2.x

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ Project: jackson-databind
44
=== Releases ===
55
------------------------------------------------------------------------
66

7+
2.14.1 (not yet released)
8+
9+
#3655: `Enum` values can not be read from single-element array even with
10+
`DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS`
11+
(reported by Andrej M)
12+
(fix contributed by Jonas K)
13+
714
2.14.0 (05-Nov-2022)
815

916
#1980: Add method(s) in `JsonNode` that works like combination of `at()`

src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializer.java

+2
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,8 @@ protected Object _deserializeFromArray(JsonParser p, DeserializationContext ctxt
644644
}
645645
return value;
646646
}
647+
// 15-Nov-2022, tatu: ... we probably should pass original `JsonToken.START_ARRAY`
648+
// as unexpected token, since `p` now points to `unwrappedToken` instead...
647649
}
648650
return ctxt.handleUnexpectedToken(getValueType(ctxt), p);
649651
}

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

+6-4
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,15 @@ public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx
150150
// value is expected; otherwise Deserializer should have been used earlier
151151
// 14-Jan-2022, tatu: as per [databind#3369] need to consider structured
152152
// value types (Object, Array) as well.
153+
// 15-Nov-2022, tatu: Fix for [databind#3655] requires handling of possible
154+
// unwrapping, do it here
153155
JsonToken t = p.currentToken();
154-
boolean unwrapping = false;
155-
if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) {
156+
boolean unwrapping = (t == JsonToken.START_ARRAY)
157+
&& ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS);
158+
if (unwrapping) {
156159
t = p.nextToken();
157-
unwrapping = true;
158160
}
159-
if ((t != null) && !t.isScalarValue()) {
161+
if ((t == null) || !t.isScalarValue()) {
160162
// Could argue we should throw an exception but...
161163
value = "";
162164
p.skipChildren();

0 commit comments

Comments
 (0)