Specification of Properties.load() does not define behaviour in case of duplicate keys

Patrick Reinhart patrick at reini.net
Thu Jan 9 09:35:05 UTC 2020


He everyone,


When loading a properties file using java.util.Properties.load() the 
behaviour for duplicate key values is not yet specified.

The actual implementation overwrites existing key/value defined within 
the current file by the further down without any warning or exception. 
This has lead to various hard to detect errors as in big property files, 
where multiple existences of the same property key.

I would like to extend the existing specification in that regard that 
only the first key/value pair will be taken into account and be added to 
the properties.

Alternatively new methods using this behaviour could also introduced...


-Patrick


More information about the core-libs-dev mailing list