[PATCH libreoffice-4-0] fdo#58949 EmbeddedObjectContainer: guard against embed::Wron...

Miklos Vajna (via Code Review) gerrit at gerrit.libreoffice.org
Fri Apr 26 05:30:41 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3624

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/24/3624/1

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
---
M comphelper/source/container/embeddedobjectcontainer.cxx
1 file changed, 10 insertions(+), 5 deletions(-)



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 @@
                         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 @@
         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

-- 
To view, visit https://gerrit.libreoffice.org/3624
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I71a7abc45a89bebc667664bc001245bb886a8d83
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Miklos Vajna <vmiklos at suse.cz>



More information about the LibreOffice mailing list