diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-03-20 16:40:46 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-03-20 16:41:28 +0100 |
commit | 190b9257367884fa8561410ebe6fb9df7fd9c465 (patch) | |
tree | 092e8fdbdba4ce662f5d53520c25a5c3a4eb3713 /desktop/source/migration | |
parent | 720243baae25d15acd6ac0dbe144a02102867a16 (diff) |
deb#703486: Keep migrating more user extensions after one failed
Change-Id: I9cc8acac54bd5a02652462c3967b4c81f7cf8ee3
Diffstat (limited to 'desktop/source/migration')
-rw-r--r-- | desktop/source/migration/services/oo3extensionmigration.cxx | 55 | ||||
-rw-r--r-- | desktop/source/migration/services/oo3extensionmigration.hxx | 6 |
2 files changed, 22 insertions, 39 deletions
diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index 6ca9cc22d25e..83426b1eec87 100644 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/xml/dom/DocumentBuilder.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/deployment/ExtensionManager.hpp> +#include <com/sun/star/deployment/XExtensionManager.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -296,47 +297,29 @@ bool OO3ExtensionMigration::scanDescriptionXml( const ::rtl::OUString& sDescript return true; } -bool OO3ExtensionMigration::migrateExtension( const ::rtl::OUString& sSourceDir ) +void OO3ExtensionMigration::migrateExtension( const ::rtl::OUString& sSourceDir ) { - if ( !m_xExtensionManager.is() ) + css::uno::Reference< css::deployment::XExtensionManager > extMgr( + deployment::ExtensionManager::get( m_ctx ) ); + try { - try - { - m_xExtensionManager = deployment::ExtensionManager::get( m_ctx ); - } - catch ( const ucb::CommandFailedException & ){} - catch ( const uno::RuntimeException & ) {} + TmpRepositoryCommandEnv* pCmdEnv = new TmpRepositoryCommandEnv(); + + uno::Reference< ucb::XCommandEnvironment > xCmdEnv( + static_cast< cppu::OWeakObject* >( pCmdEnv ), uno::UNO_QUERY ); + uno::Reference< task::XAbortChannel > xAbortChannel; + uno::Reference< deployment::XPackage > xPackage = + extMgr->addExtension( + sSourceDir, uno::Sequence<beans::NamedValue>(), + "user", xAbortChannel, xCmdEnv ); } - - if ( m_xExtensionManager.is() ) + catch ( css::uno::Exception & e ) { - try - { - TmpRepositoryCommandEnv* pCmdEnv = new TmpRepositoryCommandEnv(); - - uno::Reference< ucb::XCommandEnvironment > xCmdEnv( - static_cast< cppu::OWeakObject* >( pCmdEnv ), uno::UNO_QUERY ); - uno::Reference< task::XAbortChannel > xAbortChannel; - uno::Reference< deployment::XPackage > xPackage = - m_xExtensionManager->addExtension( - sSourceDir, uno::Sequence<beans::NamedValue>(), - "user", xAbortChannel, xCmdEnv ); - - if ( xPackage.is() ) - return true; - } - catch ( const ucb::CommandFailedException& ) - { - } - catch ( const ucb::CommandAbortedException& ) - { - } - catch ( const lang::IllegalArgumentException& ) - { - } + SAL_WARN( + "desktop.migration", + "Ignoring UNO Exception while migrating extension from <" + << sSourceDir << ">: \"" << e.Message << "\""); } - - return false; } diff --git a/desktop/source/migration/services/oo3extensionmigration.hxx b/desktop/source/migration/services/oo3extensionmigration.hxx index a3db98abedb2..96a8b2290443 100644 --- a/desktop/source/migration/services/oo3extensionmigration.hxx +++ b/desktop/source/migration/services/oo3extensionmigration.hxx @@ -26,7 +26,8 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/xml/dom/XDocumentBuilder.hpp> #include <com/sun/star/ucb/SimpleFileAccess.hpp> -#include <com/sun/star/deployment/XExtensionManager.hpp> +#include <com/sun/star/ucb/XCommandEnvironment.hpp> +#include <com/sun/star/ucb/XProgressHandler.hpp> #include <osl/mutex.hxx> #include <osl/file.hxx> @@ -68,7 +69,6 @@ namespace migration ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_ctx; ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XDocumentBuilder > m_xDocBuilder; ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 > m_xSimpleFileAccess; - ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; ::osl::Mutex m_aMutex; ::rtl::OUString m_sSourceDir; ::rtl::OUString m_sTargetDir; @@ -85,7 +85,7 @@ namespace migration ScanResult scanExtensionFolder( const ::rtl::OUString& sExtFolder ); void scanUserExtensions( const ::rtl::OUString& sSourceDir, TStringVector& aMigrateExtensions ); bool scanDescriptionXml( const ::rtl::OUString& sDescriptionXmlFilePath ); - bool migrateExtension( const ::rtl::OUString& sSourceDir ); + void migrateExtension( const ::rtl::OUString& sSourceDir ); public: OO3ExtensionMigration(::com::sun::star::uno::Reference< |