summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorJoachim Lingner <jl@openoffice.org>2010-06-10 16:55:56 +0200
committerJoachim Lingner <jl@openoffice.org>2010-06-10 16:55:56 +0200
commit463d6da2397ff113907eaa710fe711ee444ed3da (patch)
treedeefda76d64c96576be2d47dca30eeff0f39fd3c /desktop
parent2d03198027d5422eb374696b827268033338e73e (diff)
jl152 #i77196# backend db wrote double entries if there was an ambiguous extension, and XExtensionManager::synchronize was run
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/deployment/registry/dp_backenddb.cxx20
1 files changed, 15 insertions, 5 deletions
diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx
index 1f4a62e696d7..14b4f2374c5b 100644
--- a/desktop/source/deployment/registry/dp_backenddb.cxx
+++ b/desktop/source/deployment/registry/dp_backenddb.cxx
@@ -425,14 +425,24 @@ Reference<css::xml::dom::XNode> BackendDb::writeKeyElement(
const Reference<css::xml::dom::XDocument> doc = getDocument();
const Reference<css::xml::dom::XNode> root = doc->getFirstChild();
-#if OSL_DEBUG_LEVEL > 0
- //There must not be yet an entry with the same url
+ //Check if there are an entry with the same url. This can be the case if the
+ //the status of an XPackage is ambiguous. In this case a call to activateExtension
+ //(dp_extensionmanager.cxx), will register the package again. See also
+ //Package::processPackage_impl in dp_backend.cxx.
+ //A package can become
+ //invalid after its successful registration, for example if a second extension with
+ //the same service is installed.
const OUString sExpression(
sPrefix + OUSTR(":") + sElementName + OUSTR("[@url = \"") + url + OUSTR("\"]"));
- const Reference<css::xml::dom::XNode> _extensionNode =
+ const Reference<css::xml::dom::XNode> existingNode =
getXPathAPI()->selectSingleNode(root, sExpression);
- OSL_ASSERT(! _extensionNode.is());
-#endif
+ if (existingNode.is())
+ {
+ OSL_ASSERT(0);
+ //replace the existing entry.
+ removeEntry(url);
+ }
+
const Reference<css::xml::dom::XElement> keyElement(
doc->createElementNS(sNameSpace, sPrefix + OUSTR(":") + sElementName));