Avoid empty string as a value for property keys

Description

We support both empty string and unset (in code, null) for property key values. This is confusing from a user perspective, especially because our configuration documentation renders empty string the same as unset. They may even have different meanings, since Configuration#containsKey is false when a key is unset/null but true for empty string. We should standardize on one of the two to mean "not set", probably "null". We can generate a warning if a user sets a property key to empty string, and have a test to verify that we don't use empty string as a default value for any of our property keys.

Environment

None

Activity

Show:
Zac Blanco
October 3, 2018, 6:24 PM

I think the containsKey method should treat an empty string and null as both being "unset" (i.e. containsKey returns false in both cases). In turn I think we should try to remove as many empty string uses as possible. In Configuration.set we should throw an exception if someone tries to set a configuration property to "".

There also seems to be a few cases with default values of ““. We should aim to remove these and make sure it doesn’t break functionality anywhere.

Andrew Audibert
October 3, 2018, 6:36 PM

Sounds good. If we can get rid of all uses of ““ as a property value, Configuration#containsKey will only need to check for null.

Zac Blanco
October 4, 2018, 5:45 PM

Assignee

Zac Blanco

Reporter

Zac Blanco

Labels

None

Components

Fix versions

Affects versions

Priority

Minor
Configure