[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - xmloff/source

Michael Stahl mstahl at redhat.com
Fri Dec 12 01:16:01 PST 2014


 xmloff/source/text/XMLTextFrameContext.cxx |   10 +++++++++-
 xmloff/source/text/txtimp.cxx              |    8 ++------
 2 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit f3fee25f5767f01a7d3e7edcddc145ebf1326e9b
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Dec 10 14:10:16 2014 +0100

    fdo#87110: xmloff: don't catch IllegalArgumentException here
    
    There are at least 2 callers of InsertTextContent() that have
    non-trivial catch handlers for this exception, which aren't called now.
    
    (regression from bebf8ccfba37f77d6a43c7874249b31736467b17)
    
    Change-Id: I085b710dfd5877e9b7e71610951543eddf6a6e46
    (cherry picked from commit b86f5530161a417d31e28e75408ee80352fadad7)
    Reviewed-on: https://gerrit.libreoffice.org/13425
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx
index c16c38b..eb24cfd 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -759,7 +759,15 @@ void XMLTextFrameContext_Impl::Create( bool /*bHRefOrBase64*/ )
         XML_TEXT_FRAME_FLOATING_FRAME != nType)
     {
         Reference < XTextContent > xTxtCntnt( xPropSet, UNO_QUERY );
-        xTextImportHelper->InsertTextContent( xTxtCntnt );
+        try
+        {
+            xTextImportHelper->InsertTextContent(xTxtCntnt);
+        }
+        catch (lang::IllegalArgumentException const& e)
+        {
+            SAL_WARN("xmloff.text", "Cannot import part of the text - probably an image in the text frame? " << e.Message);
+            return;
+        }
     }
 
     // #107848#
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 5c5e17e..191e81a 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -1154,12 +1154,8 @@ void XMLTextImportHelper::InsertTextContent(
     DBG_ASSERT(m_pImpl->m_xCursorAsRange.is(), "no range");
     if (m_pImpl->m_xText.is())
     {
-        try {
-            m_pImpl->m_xText->insertTextContent( m_pImpl->m_xCursorAsRange, xContent, sal_False);
-        } catch ( const lang::IllegalArgumentException & )
-        {
-            SAL_WARN( "xmloff", "Cannot import part of the text - probably an image in the text frame?" );
-        }
+        // note: this may throw IllegalArgumentException and callers handle it
+        m_pImpl->m_xText->insertTextContent( m_pImpl->m_xCursorAsRange, xContent, sal_False);
     }
 }
 


More information about the Libreoffice-commits mailing list