[Libreoffice-commits] core.git: Branch 'libreoffice-7-1-1' - sfx2/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Feb 23 14:16:22 UTC 2021


 sfx2/source/doc/SfxDocumentMetaData.cxx |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

New commits:
commit b402f12ac3b63727d459742b6d6131bda0606a99
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Feb 14 19:25:40 2021 +0200
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Feb 23 15:15:46 2021 +0100

    tdf#140308 Crash import old OpenOffice template
    
    regression from
        commit cfe5a5044845a3fc90e3634e996edb4d85808d3c
        sfx2: use the fastparser API when possible
    
    We end up using the OOo2OasisTransformer filter,
    which is not fastparser compatible
    
    Bisected with: bibisect-linux64-7.1
    
    Change-Id: I7bd4191f098096034dc8ff368aba4b1ff313ce18
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110883
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit 228f43f2e3c2896c227f1ea30c5d16231acf66da)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110866
    (cherry picked from commit 6da480d946a7b881ca0cd482db16d8c32b5380ac)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110871
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 578322556b60..36d8dde0d75c 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -48,6 +48,7 @@
 #include <com/sun/star/document/XFilter.hpp>
 #include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/Writer.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/XFastParser.hpp>
 #include <com/sun/star/xml/dom/DOMException.hpp>
 #include <com/sun/star/xml/dom/XDocument.hpp>
@@ -1765,13 +1766,19 @@ SfxDocumentMetaData::loadFromStorage(
         xMsf->createInstanceWithArgumentsAndContext(
             OUString::createFromAscii(pServiceName), args, m_xContext);
     assert(xFilter);
-    css::uno::Reference<css::xml::sax::XFastParser> xDocHandler(xFilter, css::uno::UNO_QUERY);
-    assert(xDocHandler);
-    css::uno::Reference<css::document::XImporter> xImp(xDocHandler, css::uno::UNO_QUERY);
-    assert(xImp);
+    css::uno::Reference<css::xml::sax::XFastParser> xFastParser(xFilter, css::uno::UNO_QUERY);
+    css::uno::Reference<css::document::XImporter> xImp(xFilter, css::uno::UNO_QUERY_THROW);
     xImp->setTargetDocument(css::uno::Reference<css::lang::XComponent>(this));
     try {
-        xDocHandler->parseStream(input);
+        if (xFastParser)
+            xFastParser->parseStream(input);
+        else
+        {
+            css::uno::Reference<css::xml::sax::XDocumentHandler> xDocHandler(xFilter, css::uno::UNO_QUERY_THROW);
+            css::uno::Reference<css::xml::sax::XParser> xParser = css::xml::sax::Parser::create(m_xContext);
+            xParser->setDocumentHandler(xDocHandler);
+            xParser->parseStream(input);
+        }
     } catch (const css::xml::sax::SAXException &) {
         throw css::io::WrongFormatException(
                 "SfxDocumentMetaData::loadFromStorage:"


More information about the Libreoffice-commits mailing list