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

Stephan Bergmann sbergman at redhat.com
Thu Mar 21 07:55:09 PDT 2013


 desktop/source/migration/services/oo3extensionmigration.cxx |   54 ++++--------
 desktop/source/migration/services/oo3extensionmigration.hxx |    6 -
 2 files changed, 21 insertions(+), 39 deletions(-)

New commits:
commit c09c5a1e42b898a1d1558377695f609c4426d50c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 20 16:40:46 2013 +0100

    deb#703486: Keep migrating more user extensions after one failed
    
    (cherry picked from commit 190b9257367884fa8561410ebe6fb9df7fd9c465)
    Conflicts:
    	desktop/source/migration/services/oo3extensionmigration.cxx
    
    Change-Id: I9cc8acac54bd5a02652462c3967b4c81f7cf8ee3
    Reviewed-on: https://gerrit.libreoffice.org/2878
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Reviewed-by: Noel Power <noel.power at suse.com>
    Tested-by: Noel Power <noel.power at suse.com>

diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx
index aed03fa..508ca25 100644
--- a/desktop/source/migration/services/oo3extensionmigration.cxx
+++ b/desktop/source/migration/services/oo3extensionmigration.cxx
@@ -40,6 +40,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;
@@ -304,47 +305,28 @@ 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;
+        extMgr->addExtension(
+            sSourceDir, uno::Sequence<beans::NamedValue>(),
+            ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("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>(),
-                    ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("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 a3db98a..96a8b22 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<


More information about the Libreoffice-commits mailing list