Closed tomas-knap closed 10 years ago
Well, I thing that the possible reason is wrong..
If you introduce the new value .. and you deserialize (the tag is missing) then the null is assigned. If you add new value and you know about it, then you should use onDesirialize method .. check for null, consistency and update your configuration.
We may try to change this (if it's possible) but then .. does this feature, when we use default value instead of null ,bring some danger? Like .. inconsistency in config and so on. As there might be some "config-mixes" from different version as the fields were added and removed.
Well the default value should be used only in case of missing/null value. Otherwise, if there is already some value and new default value is defined, it is not overwritten automatically.
Alternatively, we can just add to the doc: "If you introduce the new value .. and you deserialize (the tag is missing) then the null is assigned. If you add new value and you know about it, then you should use onDesirialize method .. check for null, consistency and update your configuration."
Petr, so the default value is used only in case of missing/null value. Otherwise, if there is already some value and new default value is defined, it is not overwritten automatically?
Well, basically it's only for import. As then the whole configuration is never null and the default values are used only if the whole configuration is null.
If you add value ... it's set to null in case of de-serialization regardless what value you assign to it in constructor as default.
ok
To reproduce:
Possible Reason: The DPU template with the null value was saved, although user selected to discard changes
@skodape Assigning to you, because it is related with configurations.