Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2877

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/77/2877/1

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
---
M desktop/source/migration/services/oo3extensionmigration.cxx
M desktop/source/migration/services/oo3extensionmigration.hxx
2 files changed, 21 insertions(+), 39 deletions(-)



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 @@
     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();
 
-    if ( m_xExtensionManager.is() )
+        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 );
+    }
+    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 @@
         ::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 @@
         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<

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9cc8acac54bd5a02652462c3967b4c81f7cf8ee3
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Stephan Bergmann <sbergman@redhat.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.