-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Milestone
Description
Hi, I've noticed a behavior I think should be different with
@jsonsetter(value = "foo", nulls = Nulls.SKIP)
private String foo;
and with .configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true)
in that case, I would expect that if there is an unknown enum the setter will skip the null set, as I told him I don't want you to set null.
but what is probably happening is that it sees a value which is not null so it tries to set it, then when it can't set it, it becomes null.
I realize that it will be probably hard to fix, but on the other hand, the whole point of the nulls attribute is to do something else with nulls...
test case:
public enum NUMS{
ONE, TWO
}
public static class Pojo {
@JsonSetter(value = "number", nulls = Nulls.SKIP)
NUMS number = NUMS.TWO;
}
public void foo() {
ObjectMapper parser = new ObjectMapper();
parser.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true);
String json = "{\"number\":\"THREE\"}";
try {
Pojo p = parser.readValue(json, Pojo.class);
//p.number == null , should be TWO
} catch (IOException e) { }
}
Metadata
Metadata
Assignees
Labels
No labels