Rework compat check of ManifestHal vs. MatrixHal
<interface> and <instance> in a compatibility-matrix.hal
also needs to be checked in a manifest.hal. Specifically,
all instances specified in compatibility-matrix.hal
must be present in manifest.hal, although they can span
across different tag elements. See tests for samples.
For details, see:
go/android-treble-vintf-object
Test: libvintf_test
Test: vintf_object_test
Bug: 38395193
Change-Id: Ia009c5a1d779818594efc4c7f485d9fe4f23ed55
Merged-In: Ia009c5a1d779818594efc4c7f485d9fe4f23ed55
diff --git a/parse_xml.cpp b/parse_xml.cpp
index 8caab4f..f2f3096 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -158,8 +158,11 @@
}
inline bool deserialize(Object *o, const std::string &xml) const {
DocType *doc = createDocument(xml);
- bool ret = doc != nullptr
- && deserialize(o, getRootChild(doc));
+ if (doc == nullptr) {
+ this->mLastError = "Not a valid XML";
+ return false;
+ }
+ bool ret = deserialize(o, getRootChild(doc));
deleteDocument(doc);
return ret;
}