[Libreoffice-commits] core.git: 3 commits - desktop/source

Stephan Bergmann sbergman at redhat.com
Tue Feb 5 04:08:50 PST 2013


 desktop/source/deployment/manager/dp_extensionmanager.cxx     |   22 ++++++++--
 desktop/source/deployment/registry/component/dp_component.cxx |   22 ++++++++--
 desktop/source/deployment/registry/dp_backend.cxx             |    9 ++++
 3 files changed, 46 insertions(+), 7 deletions(-)

New commits:
commit 2a31dd4025eff8d09ab207f31bacc0a5b8c36bd9
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 5 13:03:31 2013 +0100

    Cleanly remove components from rdb again that fail during live insertion
    
    Such failure happens e.g. for components that bring along duplicate UNO
    implementation names, and if they ever got added to an rdb, LO would afterwards
    refuse to start forever.
    
    Change-Id: Ia62ac496547a45f5a72fdc81543f15a417c09687

diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx
index 42a09cb..0704e92 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -1409,12 +1409,13 @@ void BackendImpl::ComponentPackageImpl::processPackage_(
                     css::uno::UNO_QUERY_THROW);
             }
         }
-        css::uno::Reference< css::registry::XImplementationRegistration>(
+        css::uno::Reference< css::registry::XImplementationRegistration> impreg(
             context->getServiceManager()->createInstanceWithContext(
                 "com.sun.star.registry.ImplementationRegistration",
                 context),
-            css::uno::UNO_QUERY_THROW)->registerImplementation(
-                m_loader, url, getRDB());
+            css::uno::UNO_QUERY_THROW);
+        css::uno::Reference< css::registry::XSimpleRegistry > rdb(getRDB());
+        impreg->registerImplementation(m_loader, url, rdb);
         // Only write to unorc after successful registration; it may fail if
         // there is no suitable java
         if (m_loader == "com.sun.star.loader.Java2" && !jarManifestHeaderPresent(url, "UNO-Type-Path", xCmdEnv))
@@ -1425,7 +1426,20 @@ void BackendImpl::ComponentPackageImpl::processPackage_(
         std::vector< css::uno::Reference< css::uno::XInterface > > factories;
         getComponentInfo(&data, startup ? 0 : &factories, context);
         if (!startup) {
-            componentLiveInsertion(data, factories);
+            try {
+                componentLiveInsertion(data, factories);
+            } catch (css::uno::Exception & e) {
+                SAL_INFO(
+                    "desktop.deployment", "caught Exception " << e.Message);
+                try {
+                    impreg->revokeImplementation(url, rdb);
+                } catch (css::uno::RuntimeException & e2) {
+                    SAL_WARN(
+                        "desktop.deployment",
+                        "ignored RuntimeException " << e2.Message);
+                }
+                throw;
+            }
         }
         m_registered = REG_REGISTERED;
         that->addDataToDb(url, data);
commit 3c71fa1e5ee6cd83f713c65a372006bc3aef0953
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 5 13:01:05 2013 +0100

    Cleanly remove an extension again that cannot be activated while installing it
    
    ...otherwise, it will needlessly be carried forward marked "broken."
    
    Change-Id: I12fbd4430e1ecc11f1969ae5f49aed43668f2c27

diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index 9add425..194dd87 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -693,6 +693,10 @@ Reference<deploy::XPackage> ExtensionManager::addExtension(
         xOldExtension );
 
     {
+        bool added = false;
+        OUString sNewExtensionIdentifier;
+        OUString sNewExtensionFileName;
+
         // In this garded section (getMutex) we must not use the argument xCmdEnv
         // because it may bring up dialogs (XInteractionHandler::handle) this
         //may potententially deadlock. See issue
@@ -737,6 +741,7 @@ Reference<deploy::XPackage> ExtensionManager::addExtension(
                     xNewExtension = xPackageManager->addPackage(
                         url, properties, OUString(), xAbortChannel,
                         Reference<ucb::XCommandEnvironment>());
+                    added = true;
                     //If we add a user extension and there is already one which was
                     //disabled by a user, then the newly installed one is enabled. If we
                     //add to another repository then the user extension remains
@@ -745,9 +750,8 @@ Reference<deploy::XPackage> ExtensionManager::addExtension(
                     if (repository == "user")
                         bUserDisabled2 = false;
 
-                    // pass the two values via variables to workaround gcc-4.3.4 specific bug (bnc#655912)
-                    OUString sNewExtensionIdentifier = dp_misc::getIdentifier(xNewExtension);
-                    OUString sNewExtensionFileName = xNewExtension->getName();
+                    sNewExtensionIdentifier = dp_misc::getIdentifier(xNewExtension);
+                    sNewExtensionFileName = xNewExtension->getName();
 
                     activateExtension(
                         sNewExtensionIdentifier, sNewExtensionFileName,
@@ -792,6 +796,18 @@ Reference<deploy::XPackage> ExtensionManager::addExtension(
             //If the user aborted installation then a ucb::CommandAbortedException
             //is thrown.
             //Use a private AbortChannel so the user cannot interrupt.
+            if (added) {
+                try {
+                    xPackageManager->removePackage(
+                        sNewExtensionIdentifier, sNewExtensionFileName,
+                        css::uno::Reference< css::task::XAbortChannel >(),
+                        css::uno::Reference< css::ucb::XCommandEnvironment >());
+                } catch (css::uno::Exception & e) {
+                    SAL_WARN(
+                        "desktop.deployment",
+                        "ignoring Exception " << e.Message);
+                }
+            }
             try
             {
                 if (xExtensionBackup.is())
commit 3d23c626e685f8ab3ee1780f10f368ee8ede61d0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 5 12:52:46 2013 +0100

    Avoid a SAL_WARN caused by IllegalArgumentEx now being a RuntimeEx
    
    Change-Id: I6fad4e840cf47b4d41592ff179f66943a4469760

diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index 429a6f7..07cadb6 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -669,6 +669,15 @@ void Package::processPackage_impl(
                                  xCmdEnv );
             }
         }
+        catch (lang::IllegalArgumentException &) {
+            Any e(cppu::getCaughtException());
+            throw deployment::DeploymentException(
+                ((doRegisterPackage
+                  ? getResourceString(RID_STR_ERROR_WHILE_REGISTERING)
+                  : getResourceString(RID_STR_ERROR_WHILE_REVOKING))
+                 + getDisplayName()),
+                static_cast< OWeakObject * >(this), e);
+        }
         catch (const RuntimeException &e) {
             SAL_WARN(
                 "desktop.deployment",


More information about the Libreoffice-commits mailing list