java.util.Properties: reproducible write
Rafael Winterhalter
rafael.wth at gmail.com
Mon Nov 25 21:53:41 UTC 2024
Hello,
I find the java.util.Properties class to be quite convenient when writing
minor collections of key-values. One unfortunate implication of the store
method is that it always contains a comment line with the current date. The
comment is never deserialized when loading the file, but the file hash is
of course always changed, even if the content is identical at a later time.
This can have unfortunate implications when the file hash is relevant to
some form of cashing or validation mechanism.
Would it be a good idea to add an overload that allows disabling the date
comment? This would only require minimal code changes and the storage
format would become reproducible. The key-values are already sorted by
their key. The date can be fixed by a system property, but this is not
always possible to define if the writer is not in control of the command
line. Right now I have to reimplement the Properties::store method only to
exclude this line.
Thanks for your consideration and opinion,
Rafael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20241125/d9483f33/attachment.htm>
More information about the core-libs-dev
mailing list