diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-04-26 11:46:57 +0200 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2013-04-29 17:28:13 +0000 |
commit | 800b17fd80433163e323775862a528fbebe60a11 (patch) | |
tree | ad34929dff080e78dd4a97b468aba27b3148b5d0 | |
parent | fixed out of bounds vector access (diff) | |
download | core-800b17fd80433163e323775862a528fbebe60a11.tar.gz core-800b17fd80433163e323775862a528fbebe60a11.zip |
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@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Reviewed-on: https://gerrit.libreoffice.org/3658
Tested-by: Petr Mladek <pmladek@suse.cz>
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
Reviewed-by: Petr Mladek <pmladek@suse.cz>
-rw-r--r-- | comphelper/source/container/embeddedobjectcontainer.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx index ca0e4f112bea..935bf33061c3 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 |