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

Miklos Vajna vmiklos at suse.cz
Mon Apr 29 10:28:34 PDT 2013


 comphelper/source/container/embeddedobjectcontainer.cxx |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit 800b17fd80433163e323775862a528fbebe60a11
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Apr 26 11:46:57 2013 +0200

    fdo#58949 EmbeddedObjectContainer: guard against embed::WrongStateException
    
    The problem was that in case an exception was thrown, it was only caught
    outside the loop, so in case any error occurred, we didn't even try to
    export the remaining objects. At least in case of
    embed::WrongStateException, this is safe to do.
    
    (cherry picked from commit 6238cfe27f0a202f3fbf482cde2b0a3189adc86f)
    
    Change-Id: I71a7abc45a89bebc667664bc001245bb886a8d83
    Reviewed-on: https://gerrit.libreoffice.org/3624
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>
    Reviewed-on: https://gerrit.libreoffice.org/3658
    Tested-by: Petr Mladek <pmladek at suse.cz>
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>
    Reviewed-by: Petr Mladek <pmladek at suse.cz>

diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index ca0e4f1..935bf33 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -1415,10 +1415,14 @@ sal_Bool EmbeddedObjectContainer::StoreAsChildren(sal_Bool _bOasisFormat,sal_Boo
                         aArgs[2].Value <<= xStream;
                     }
 
-                    xPersist->storeAsEntry( _xStorage,
-                                            xPersist->getEntryName(),
-                                            uno::Sequence< beans::PropertyValue >(),
-                                            aArgs );
+                    try
+                    {
+                        xPersist->storeAsEntry( _xStorage, xPersist->getEntryName(), uno::Sequence< beans::PropertyValue >(), aArgs );
+                    }
+                    catch (const embed::WrongStateException& e)
+                    {
+                        SAL_WARN("comphelper", "failed to store '" << *pIter << "'");
+                    }
                 }
 
                 if ( bSwitchBackToLoaded )
@@ -1430,10 +1434,11 @@ sal_Bool EmbeddedObjectContainer::StoreAsChildren(sal_Bool _bOasisFormat,sal_Boo
         bResult = aCnt.CommitImageSubStorage();
 
     }
-    catch (const uno::Exception&)
+    catch (const uno::Exception& e)
     {
         // TODO/LATER: error handling
         bResult = sal_False;
+        SAL_WARN("comphelper", "failed. Message: " << e.Message);
     }
 
     // the old SO6 format does not store graphical replacements


More information about the Libreoffice-commits mailing list