Skip to content

Commit

Permalink
Fix #2015 (or, rather, add test to verify, likely fixed with #2023)
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed May 5, 2018
1 parent a50ef5a commit eea460b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Project: jackson-databind
#2001: Deserialization issue with `@JsonIgnore` and `@JsonCreator` + `@JsonProperty`
for same property name
(reported, fix contributed by Jakub S)
#2015: `@Jsonsetter with Nulls.SKIP` collides with
`DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL` when parsing enum
(reported by ndori@github)
#2016: Delegating JsonCreator disregards JsonDeserialize info
(reported by Carter K)
#2019: Abstract Type mapping in 2.9 fails when multiple modules are registered
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ public void setValue(String v) {
}
}

// for [databind#2015]
enum NUMS2015 {
ONE, TWO
}

public static class Pojo2015 {
@JsonSetter(value = "number", nulls = Nulls.SKIP)
NUMS2015 number = NUMS2015.TWO;
}

/*
/**********************************************************
/* Test methods, straight annotation
Expand Down Expand Up @@ -72,6 +82,15 @@ public void testSkipNullMethod() throws Exception
assertEquals("a", result._nullsOk);
}

// for [databind#2015]
public void testEnumAsNullThenSkip() throws Exception
{
Pojo2015 p = MAPPER.readerFor(Pojo2015.class)
.with(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL)
.readValue("{\"number\":\"THREE\"}");
assertEquals(NUMS2015.TWO, p.number);
}

/*
/**********************************************************
/* Test methods, defaulting
Expand Down

0 comments on commit eea460b

Please sign in to comment.