[Libreoffice-commits] core.git: chart2/source

Noel (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 16 10:28:11 UTC 2020


 chart2/source/model/filter/XMLFilter.cxx |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit e1a47ddab37e70c400de254251be38e844117cc1
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Fri Oct 16 09:16:41 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Oct 16 12:27:31 2020 +0200

    chart2: use the fastparser API when possible
    
    part of the process of making SvXMLImport fastparser-only
    
    Change-Id: I9fd7dbcc8b5c345f7e86bc06b1b898b7d39f36da
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104412
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
index 3980e96003e2..76f88027a0e2 100644
--- a/chart2/source/model/filter/XMLFilter.cxx
+++ b/chart2/source/model/filter/XMLFilter.cxx
@@ -440,11 +440,11 @@ ErrCode XMLFilter::impl_ImportStream(
                     aFilterCompArgs[ nArgs++ ] <<= xImportInfo;
 
                 // the underlying SvXMLImport implements XFastParser, XImporter, XFastDocumentHandler
-                Reference< xml::sax::XDocumentHandler  > xDocHandler(
-                    xFactory->createInstanceWithArgumentsAndContext( rServiceName, aFilterCompArgs, m_xContext ),
-                    uno::UNO_QUERY_THROW );
-
-                Reference< document::XImporter > xImporter( xDocHandler, uno::UNO_QUERY_THROW );
+                Reference< XInterface  > xFilter =
+                    xFactory->createInstanceWithArgumentsAndContext( rServiceName, aFilterCompArgs, m_xContext );
+                assert(xFilter);
+                Reference< document::XImporter > xImporter( xFilter, uno::UNO_QUERY );
+                assert(xImporter);
                 xImporter->setTargetDocument( Reference< lang::XComponent >( m_xTargetDoc, uno::UNO_SET_THROW ));
 
                 if ( !m_sDocumentHandler.isEmpty() )
@@ -454,30 +454,30 @@ ErrCode XMLFilter::impl_ImportStream(
                         uno::Sequence< uno::Any > aArgs(2);
                         beans::NamedValue aValue;
                         aValue.Name = "DocumentHandler";
-                        aValue.Value <<= xDocHandler;
+                        aValue.Value <<= xFilter;
                         aArgs[0] <<= aValue;
                         aValue.Name = "Model";
                         aValue.Value <<= m_xTargetDoc;
                         aArgs[1] <<= aValue;
 
-                        xDocHandler.set(xFactory->createInstanceWithArgumentsAndContext(m_sDocumentHandler,aArgs,m_xContext), uno::UNO_QUERY_THROW );
+                        xFilter = xFactory->createInstanceWithArgumentsAndContext(m_sDocumentHandler,aArgs,m_xContext);
                     }
                     catch (const uno::Exception&)
                     {
-                        TOOLS_WARN_EXCEPTION("chart2", "");
+                        TOOLS_WARN_EXCEPTION("chart2", "failed to instantiate " << m_sDocumentHandler);
                     }
                 }
                 xml::sax::InputSource aParserInput;
                 aParserInput.aInputStream.set(xInputStream, uno::UNO_QUERY_THROW);
 
                 // the underlying SvXMLImport implements XFastParser, XImporter, XFastDocumentHandler
-                Reference< xml::sax::XFastParser  > xFastParser(xDocHandler, uno::UNO_QUERY);
+                Reference< xml::sax::XFastParser > xFastParser(xFilter, uno::UNO_QUERY);
                 if (xFastParser.is())
                     xFastParser->parseStream(aParserInput);
                 else
                 {
                     Reference<xml::sax::XParser> xParser = xml::sax::Parser::create(m_xContext);
-                    xParser->setDocumentHandler( xDocHandler );
+                    xParser->setDocumentHandler( uno::Reference<xml::sax::XDocumentHandler>(xFilter, uno::UNO_QUERY_THROW) );
                     xParser->parseStream(aParserInput);
                 }
             }


More information about the Libreoffice-commits mailing list