summaryrefslogtreecommitdiffstats
path: root/xmlserializer/XmlFileDocSource.cpp
diff options
context:
space:
mode:
authorFrédéric Boisnard <fredericx.boisnard@intel.com>2012-10-18 18:20:03 +0200
committerDavid Wagner <david.wagner@intel.com>2014-02-12 17:03:29 +0100
commita409daaa0575e2e1db197a32fc95804736acf841 (patch)
tree1747dce7a6458a6f51fd3cf8dabe13e51197f354 /xmlserializer/XmlFileDocSource.cpp
parentdf6649888c0beb66e0461e1f5a15b5f676b5a048 (diff)
downloadexternal_parameter-framework-a409daaa0575e2e1db197a32fc95804736acf841.zip
external_parameter-framework-a409daaa0575e2e1db197a32fc95804736acf841.tar.gz
external_parameter-framework-a409daaa0575e2e1db197a32fc95804736acf841.tar.bz2
PFW: Prevent crash if subsystem structure missing
BZ: 62524 If the XML file defining a subsystem is missing, the PFW crashes without any message. This patch fixes this issue. Change-Id: Ibc0e9d195a8207d41d25613f56d1c9740bf6c784 Signed-off-by: Frédéric Boisnard <fredericx.boisnard@intel.com> Reviewed-on: http://android.intel.com:8080/70698 Reviewed-by: Denneulin, Guillaume <guillaume.denneulin@intel.com> Reviewed-by: Rocard, KevinX <kevinx.rocard@intel.com> Reviewed-by: Centelles, Sylvain <sylvain.centelles@intel.com> Reviewed-by: Baron, Georges-henriX <georges-henrix.baron@intel.com> Tested-by: Dixon, CharlesX <charlesx.dixon@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'xmlserializer/XmlFileDocSource.cpp')
-rw-r--r--xmlserializer/XmlFileDocSource.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/xmlserializer/XmlFileDocSource.cpp b/xmlserializer/XmlFileDocSource.cpp
index c8a0837..f1094f1 100644
--- a/xmlserializer/XmlFileDocSource.cpp
+++ b/xmlserializer/XmlFileDocSource.cpp
@@ -43,9 +43,7 @@ CXmlFileDocSource::CXmlFileDocSource(const string& strXmlInstanceFile, const str
bool CXmlFileDocSource::populate(CXmlSerializingContext& serializingContext)
{
// Check that the doc has been created
- if (!_pDoc) {
-
- serializingContext.setError("Could not parse file " + _strXmlInstanceFile);
+ if (!isParsable(serializingContext)) {
return false;
}
@@ -84,6 +82,19 @@ bool CXmlFileDocSource::populate(CXmlSerializingContext& serializingContext)
return true;
}
+bool CXmlFileDocSource::isParsable(CXmlSerializingContext& serializingContext) const
+{
+ // Check that the doc has been created
+ if (!_pDoc) {
+
+ serializingContext.setError("Could not parse file " + _strXmlInstanceFile);
+
+ return false;
+ }
+
+ return true;
+}
+
bool CXmlFileDocSource::isInstanceDocumentValid()
{
#ifdef LIBXML_SCHEMAS_ENABLED