summaryrefslogtreecommitdiff
path: root/reportdesign/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-01-13 19:08:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-01-14 07:10:37 +0100
commit7ae61449ccbeaf6a0b2aa8e81aad394b18565943 (patch)
tree9c7baf81a0bec15ced27a287d1a2eb438030fc1c /reportdesign/source
parent0dc1611ac1c2c4ad57346131394d3c7035021259 (diff)
use FastParser in reportdesign
Change-Id: Ib012e7c814184eaeaab57200107e8bf4887058f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86707 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'reportdesign/source')
-rw-r--r--reportdesign/source/filter/xml/xmlfilter.cxx25
1 files changed, 15 insertions, 10 deletions
diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx
index 2a510dee12af..917dd5209411 100644
--- a/reportdesign/source/filter/xml/xmlfilter.cxx
+++ b/reportdesign/source/filter/xml/xmlfilter.cxx
@@ -130,21 +130,15 @@ static ErrCode ReadThroughComponent(
OSL_ENSURE(xModelComponent.is(), "document missing");
OSL_ENSURE(rContext.is(), "factory missing");
- // prepare ParserInputSrouce
+ // prepare Parser InputSource
InputSource aParserInput;
aParserInput.aInputStream = xInputStream;
- // get parser
- uno::Reference< XParser > xParser = xml::sax::Parser::create(rContext);
- SAL_INFO( "reportdesign", "parser created" );
// get filter
- OSL_ENSURE( _xFilter.is(), "Can't instantiate filter component." );
+ SAL_WARN_IF( !_xFilter.is(), "reportdesign", "Can't instantiate filter component." );
if( !_xFilter.is() )
return ErrCode(1);
- // connect parser and filter
- xParser->setDocumentHandler( _xFilter );
-
// connect model and filter
uno::Reference < XImporter > xImporter( _xFilter, UNO_QUERY );
xImporter->setTargetDocument( xModelComponent );
@@ -152,11 +146,20 @@ static ErrCode ReadThroughComponent(
// finally, parser the stream
try
{
- xParser->parseStream( aParserInput );
+ uno::Reference < XFastParser > xFastParser( _xFilter, UNO_QUERY );\
+ if (xFastParser.is())
+ xFastParser->parseStream( aParserInput );
+ else
+ {
+ uno::Reference< XParser > xParser = xml::sax::Parser::create(rContext);
+ // connect parser and filter
+ xParser->setDocumentHandler( _xFilter );
+ xParser->parseStream( aParserInput );
+ }
}
catch (const SAXParseException&)
{
- TOOLS_WARN_EXCEPTION( "reportdesign", "SAX parse exception caught while importing");
+ TOOLS_WARN_EXCEPTION( "reportdesign", "");
return ErrCode(1);
}
catch (const SAXException&)
@@ -169,10 +172,12 @@ static ErrCode ReadThroughComponent(
}
catch (const IOException&)
{
+ TOOLS_WARN_EXCEPTION( "reportdesign", "");
return ErrCode(1);
}
catch (const Exception&)
{
+ TOOLS_WARN_EXCEPTION( "reportdesign", "");
return ErrCode(1);
}