Config file parsing is too lenient

Bug #1343097 reported by Michi Henning
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
unity-scopes-api (Ubuntu)
New
Medium
Unassigned

Bug Description

We have a few places in the *Config classes where settings that are not strings are not verified.

For example, setting Pageheader.Logo = 42 causes a meaningless exception to be thrown
ages after the damage was done, instead of telling the scope author "you did something silly
in the following file when you set Pageheader.Logo".

Any settings that are not strings need to be parsed to the extent that at least their type
is in agreement with their expected type. Silently ignoring them is not good enough,
and silently parsing something as an int when it should be a boolean is also not good enough.

If we have settings that need to conform to some internal syntax, such as URLs, we probably
should also verify that the string at least parses as a URL when we parse the config. That is
infinitely better than producing an error message half an hour later that, in essence, can
only say "bad URL", but not necessarily tell me where the mistake was made in the first place.

Doing this also allows code that uses config values to use them with confidence, at least to the extent that they will have the expected type. If we don't parse the config files up-front, then we need to re-verify that that settings are sane in every place where are setting is used.

affects: unity-scopes-api → unity-scopes-api (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.