summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2015-07-14 18:39:41 +0200
committerDavid Tardon <dtardon@redhat.com>2015-07-14 18:43:35 +0200
commit072a9025d0267c4faff12f28c3b0c63c383516fe (patch)
tree29152b2b33c53aae0a08c63bd720003c16be3f4c /src/lib
parentc2eb5794e865efa74fbf1c6be8ed9fadae137d85 (diff)
ignore errors when parsing metadata
Change-Id: Ia2f5e1882764899cc1dade967acbf474c7b80a3f
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/VSDXParser.cpp16
-rw-r--r--src/lib/VSDXParser.h2
2 files changed, 8 insertions, 10 deletions
diff --git a/src/lib/VSDXParser.cpp b/src/lib/VSDXParser.cpp
index e889fff..23fc541 100644
--- a/src/lib/VSDXParser.cpp
+++ b/src/lib/VSDXParser.cpp
@@ -256,15 +256,13 @@ bool libvisio::VSDXParser::parseTheme(librevenge::RVNGInputStream *input, const
return true;
}
-bool libvisio::VSDXParser::parseMetaData(librevenge::RVNGInputStream *input, libvisio::VSDXRelationships &rels)
+void libvisio::VSDXParser::parseMetaData(librevenge::RVNGInputStream *input, libvisio::VSDXRelationships &rels) try
{
if (!input)
- return false;
+ return;
input->seek(0, librevenge::RVNG_SEEK_SET);
if (!input->isStructured())
- return false;
-
- bool result = false;
+ return;
VSDXMetaData metaData;
const libvisio::VSDXRelationship *coreProp = rels.getRelationshipByType("http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties");
@@ -273,7 +271,6 @@ bool libvisio::VSDXParser::parseMetaData(librevenge::RVNGInputStream *input, lib
const RVNGInputStreamPtr_t stream(input->getSubStreamByName(coreProp->getTarget().c_str()));
if (stream)
{
- result = true;
metaData.parse(stream.get());
}
}
@@ -284,13 +281,14 @@ bool libvisio::VSDXParser::parseMetaData(librevenge::RVNGInputStream *input, lib
const RVNGInputStreamPtr_t stream(input->getSubStreamByName(extendedProp->getTarget().c_str()));
if (stream)
{
- result = true;
metaData.parse(stream.get());
}
}
m_collector->collectMetaData(metaData.getMetaData());
-
- return result;
+}
+catch (...)
+{
+ // Ignore any exceptions in metadata. They are not important enough to stop parsing.
}
void libvisio::VSDXParser::processXmlDocument(librevenge::RVNGInputStream *input, VSDXRelationships &rels)
diff --git a/src/lib/VSDXParser.h b/src/lib/VSDXParser.h
index 069204c..9eef41e 100644
--- a/src/lib/VSDXParser.h
+++ b/src/lib/VSDXParser.h
@@ -54,7 +54,7 @@ private:
bool parsePages(librevenge::RVNGInputStream *input, const char *name);
bool parsePage(librevenge::RVNGInputStream *input, const char *name);
bool parseTheme(librevenge::RVNGInputStream *input, const char *name);
- bool parseMetaData(librevenge::RVNGInputStream *input, VSDXRelationships &rels);
+ void parseMetaData(librevenge::RVNGInputStream *input, VSDXRelationships &rels);
void processXmlDocument(librevenge::RVNGInputStream *input, VSDXRelationships &rels);
void processXmlNode(xmlTextReaderPtr reader);