infinispan / infinispan/protostream

Java.Util.Date fields return 0 instead of null

Open
#282 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
56
Forks
39
Avg merge
5h 36m
Merged PRs (30d)
5

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named. Start by reproducing unmarshalling an absent Java.Util.Date field with ProtoStream v5, then inspect the date-field serialization and default-value handling; done requires determining and implementing the expected absent-value behavior, with a regression test for the observed result.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.