basic/source/uno/namecont.cxx | 45 +++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 24 deletions(-)
New commits: commit a43a18edb0023b2a9533e719c8cf3dd2f894dad7 Author: Lionel Elie Mamane <lio...@mamane.lu> Date: Fri Aug 2 23:35:20 2013 +0200 do *not* silently ignore errors when saving libraries In case of error, it leads to *data* *loss*. Change-Id: I80d806ef10a3364174eced3095ebf1ea217d75b4 diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index e49a846..6257731 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -1924,7 +1924,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto << rLib.aName << "\". Exception: " << comphelper::anyToString(aError)); #endif - return; + throw; } } @@ -1954,6 +1954,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto { DBG_UNHANDLED_EXCEPTION(); // TODO: error handling + throw; } } } @@ -2033,6 +2034,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); + throw; } } @@ -2384,7 +2386,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name ) << "\". Exception: " << comphelper::anyToString(aError)); #endif - return; + throw; } } @@ -2418,12 +2420,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name ) aFile = aElementName; aFile += "."; aFile += maLibElementFileExtension; - try - { - xElementStream = xLibraryStor->openStreamElement( aFile, embed::ElementModes::READ ); - } - catch(const uno::Exception& ) - {} + xElementStream = xLibraryStor->openStreamElement( aFile, embed::ElementModes::READ ); } if ( xElementStream.is() ) @@ -2436,7 +2433,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name ) "basic", "couldn't open library element stream - attempted to" " open library \"" << Name << '"'); - return; + throw RuntimeException("couln't open library element stream", *this); } } else commit fc9080a0c60f263d00eb71111fcda72b3c0a2ebb Author: Lionel Elie Mamane <lio...@mamane.lu> Date: Fri Aug 2 23:33:47 2013 +0200 fdo#67685 open xSourceLibrariesStor only when needed else it keeps loadLibrary from completing, because the latter cannot open the storage because it is already open in read/write mode. Change-Id: Icd0aabfff6e67af2c38a8f9185f8485b46ab1516 diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index edf724e..e49a846 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -1870,21 +1870,6 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto DBG_UNHANDLED_EXCEPTION(); return; } - - // open the source storage which might be used to copy yet-unmodified libraries - try - { - if ( mxStorage->hasByName( maLibrariesDir ) || bInplaceStorage ) - { - xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, - bInplaceStorage ? embed::ElementModes::READWRITE : embed::ElementModes::READ ); - } - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - return; - } } int iArray = 0; @@ -1984,6 +1969,21 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto // then we need to clean up the temporary storage we used for this if ( bInplaceStorage && !sTempTargetStorName.isEmpty() ) { + // open the source storage which might be used to copy yet-unmodified libraries + try + { + if ( mxStorage->hasByName( maLibrariesDir ) || bInplaceStorage ) + { + xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, + bInplaceStorage ? embed::ElementModes::READWRITE : embed::ElementModes::READ ); + } + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + return; + } + SAL_WARN_IF( !xSourceLibrariesStor.is(), "basic", ("SfxLibrariesContainer::storeLibraries_impl: unexpected: we should" _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits