[PATCH libreoffice-3-6] Cleanly remove components from rdb again that fail during li...

Stephan Bergmann (via Code Review) gerrit at gerrit.libreoffice.org
Tue Feb 5 04:22:31 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1996

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/96/1996/1

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
(cherry picked from commit 2a31dd4025eff8d09ab207f31bacc0a5b8c36bd9)
---
M desktop/source/deployment/registry/component/dp_component.cxx
1 file changed, 18 insertions(+), 4 deletions(-)



diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx
index 1243087..3baba8c 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -1478,14 +1478,15 @@
                     css::uno::UNO_QUERY_THROW);
             }
         }
-        css::uno::Reference< css::registry::XImplementationRegistration>(
+        css::uno::Reference< css::registry::XImplementationRegistration> impreg(
             context->getServiceManager()->createInstanceWithContext(
                 rtl::OUString(
                     RTL_CONSTASCII_USTRINGPARAM(
                         "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, OUSTR("UNO-Type-Path"), xCmdEnv))
@@ -1496,7 +1497,20 @@
         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);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia62ac496547a45f5a72fdc81543f15a417c09687
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-3-6
Gerrit-Owner: Stephan Bergmann <sbergman at redhat.com>


More information about the LibreOffice mailing list