Skip to content

Commit e2476e0

Browse files
committed
Backported #1642 in 2.8.9
1 parent 752bb8a commit e2476e0

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

release-notes/CREDITS

+4
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,10 @@ Andrew Joseph (apjoseph@github)
614614
for `java.util.UUID`
615615
(2.8.9)
616616

617+
Joe Littlejohn (joelittlejohn@github)
618+
* Contributed #1642: Support `READ_UNKNOWN_ENUM_VALUES_AS_NULL` with `@JsonCreator`
619+
(2.8.9)
620+
617621
Connor Kuhn (ckuhn@github)
618622
* Contributed #1341: FAIL_ON_MISSING_EXTERNAL_TYPE_ID_PROPERTY
619623
(2.9.0)

release-notes/VERSION

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Project: jackson-databind
1212
#1629: `FromStringDeserializer` ignores registered `DeserializationProblemHandler`
1313
for `java.util.UUID`
1414
(reported by Andrew J)
15+
#1642: Support `READ_UNKNOWN_ENUM_VALUES_AS_NULL` with `@JsonCreator`
16+
(contributed by Joe L)
1517

1618
2.8.8.1 (19-Apr-2017)
1719

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

+5
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx
133133
return _factory.callOnWith(_valueClass, value);
134134
} catch (Exception e) {
135135
Throwable t = ClassUtil.throwRootCauseIfIOE(e);
136+
// [databind#1642]
137+
if (ctxt.isEnabled(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL)
138+
&& (t instanceof IllegalArgumentException)) {
139+
return null;
140+
}
136141
return ctxt.handleInstantiationProblem(_valueClass, value, t);
137142
}
138143
}

0 commit comments

Comments
 (0)