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

Miklos Vajna vmiklos at suse.cz
Fri Apr 26 07:02:42 PDT 2013


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

New commits:
commit fe437463e3a3fb4cc0e388b45930742bac8c9162
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>

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