[Libreoffice-commits] core.git: 2 commits - editeng/source sax/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 19 09:13:33 UTC 2019


 editeng/source/misc/svxacorr.cxx     |    9 +++------
 sax/source/fastparser/fastparser.cxx |   14 +++++++-------
 2 files changed, 10 insertions(+), 13 deletions(-)

New commits:
commit 79ea745d595945e454ced9f6cacd2bb57aa51f95
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Nov 18 14:26:39 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Nov 19 10:12:55 2019 +0100

    use FasterParser for LoadXMLExceptList_Imp
    
    the SvXMLImport superclass of XMLVersionListImport already constructs a
    parser, so we can just use that one
    
    Change-Id: I33b7f70982d78d2303a62cae40335f3c04b73579
    Reviewed-on: https://gerrit.libreoffice.org/83083
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 71249b9b051e..24ff88d8e725 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2058,19 +2058,16 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp(
                 aParserInput.aInputStream = new utl::OInputStreamWrapper( *xStrm );
 
                 // get filter
-                uno::Reference< xml::sax::XFastDocumentHandler > xFilter = new SvXMLExceptionListImport ( xContext, *rpLst );
+                rtl::Reference< SvXMLExceptionListImport > xImport = new SvXMLExceptionListImport ( xContext, *rpLst );
 
                 // connect parser and filter
-                uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create( xContext );
                 uno::Reference<xml::sax::XFastTokenHandler> xTokenHandler = new SvXMLAutoCorrectTokenHandler;
-                xParser->setFastDocumentHandler( xFilter );
-                xParser->registerNamespace( "http://openoffice.org/2001/block-list", SvXMLAutoCorrectToken::NAMESPACE );
-                xParser->setTokenHandler( xTokenHandler );
+                xImport->setTokenHandler( xTokenHandler );
 
                 // parse
                 try
                 {
-                    xParser->parseStream( aParserInput );
+                    xImport->parseStream( aParserInput );
                 }
                 catch( const xml::sax::SAXParseException& )
                 {
commit 6e818f0a063a2db37361e42f9c49d4bb9e44945a
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Nov 19 10:05:09 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Nov 19 10:12:47 2019 +0100

    improve exception message
    
    Change-Id: Ia87e6e22e9a28b714d09c952fa9c52817b4dd21d
    Reviewed-on: https://gerrit.libreoffice.org/83159
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 9b35c1682be5..55e1a345f331 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -889,15 +889,15 @@ void FastSaxParserImpl::setTokenHandler( const Reference< XFastTokenHandler >& x
 
 void FastSaxParserImpl::registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken )
 {
-    if( NamespaceToken >= FastToken::NAMESPACE )
+    if( NamespaceToken < FastToken::NAMESPACE )
+        throw IllegalArgumentException("Invalid namespace token " + OUString::number(NamespaceToken), css::uno::Reference<css::uno::XInterface >(), 0);
+
+    if( GetNamespaceToken( NamespaceURL ) == FastToken::DONTKNOW )
     {
-        if( GetNamespaceToken( NamespaceURL ) == FastToken::DONTKNOW )
-        {
-            maNamespaceMap[ NamespaceURL ] = NamespaceToken;
-            return;
-        }
+        maNamespaceMap[ NamespaceURL ] = NamespaceToken;
+        return;
     }
-    throw IllegalArgumentException();
+    throw IllegalArgumentException("namespace URL is already registered: " + NamespaceURL, css::uno::Reference<css::uno::XInterface >(), 0);
 }
 
 OUString const & FastSaxParserImpl::getNamespaceURL( const OUString& rPrefix )


More information about the Libreoffice-commits mailing list