You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, currently using protostream v5 for a project and seeing that Java.Util.Date fields all return "0" instead of null when no value is present. I do see that proto 3 syntax has specified the following default values:
For strings, the default value is the empty string.
For bytes, the default value is empty bytes.
For bools, the default value is false.
For numeric types, the default value is zero.
For enums, the default value is the first defined enum value, which must be 0.
Is this the expected behavior with a date field? When unmarshalling it returns a value of new Date("0") which returns the following date: 1969-12-31-19:00:00
Would greatly appreciate your feedback, thank you.
The text was updated successfully, but these errors were encountered:
Since Proto 3 has done away with custom default values, fields should be initialized to their "natural" neutral value.
For Java objects, this means invoking the no-arg constructor. However, because we map java.lang.Date to a number, this is 0. The date you see is the Unix epoch
Hello, currently using protostream v5 for a project and seeing that Java.Util.Date fields all return "0" instead of null when no value is present. I do see that proto 3 syntax has specified the following default values:
For strings, the default value is the empty string.
For bytes, the default value is empty bytes.
For bools, the default value is false.
For numeric types, the default value is zero.
For enums, the default value is the first defined enum value, which must be 0.
Is this the expected behavior with a date field? When unmarshalling it returns a value of new Date("0") which returns the following date: 1969-12-31-19:00:00
Would greatly appreciate your feedback, thank you.
The text was updated successfully, but these errors were encountered: