Closed
Description
Describe the bug
When trying to deserialise an empty JSON string as java.util.Locale
, the resulting value is NULL
, when ACCEPT_EMPTY_STRING_AS_NULL_OBJECT is set to true
.
My expectation was that the empty string would be converted to Locale.ROOT
.
Version information
2.13.5
To Reproduce
The following test fails:
class JsonDeserializationTest
{
@Test
void testDeserializeRootLocale() throws JsonProcessingException
{
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true);
assertEquals(Locale.ROOT, objectMapper.readValue("\"\"", Locale.class));
}
}
When looking at the current source code at https://github.com/FasterXML/jackson-databind/blob/2.16/src/main/java/com/fasterxml/jackson/databind/cfg/CoercionConfigs.java#L241
It looks like CoercionAction.TryConvert
should be returned in this case.
Metadata
Metadata
Assignees
Labels
No labels