Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
When a JSON null value is deserialized to a primitive int field, the int field is populated with its default value of 0. (I did not check, but I wouldn't be surprised if similar handling of JSON null values is provided when deserializing to other primitive types.)
However, currently when a JSON empty string is deserialized to a primitive int, an exception is thrown, though StdDeserializer._parseIntPrimitive(JsonParser, DeserializationContext) is already capable of returning 0 from a JSON empty string.
As it's unlikely that throwing an exception for this situation is benefiting any current users, Jackson should be enhanced to deserialize JSON empty strings to the appropriate primitive default value when so bound.
See http://stackoverflow.com/questions/6661717/ for related issue and workaround using the current StdDeserializer._parseIntPrimitive(JsonParser, DeserializationContext) implementation.