Svet Ganov ba0821ed3b Make read/write from/to XML persistent state more robust.
When writing critical state to XML an excpetion can lead to creating
a malformed XML that is later parsed and may put the device in a bad
state. Hence, on any error while writing we should bail out and drop
the partially write state on the floor.

Corollary, any error on parsing can lead to having a partially read
state that is not consistent which may lead to writing this bad state
back to disk. Hence, on any error while parsing we should bail as
our current state may be unrecoverable.

Change-Id: Ia050c16198cb583f8a51263ad2035dbb948052b8
2015-04-22 13:42:54 -07:00
..
2015-03-21 02:02:20 -05:00