From 9159c4372be80787e852350188d8b47466fa5ee8 Mon Sep 17 00:00:00 2001 From: antelder Date: Wed, 17 Aug 2011 14:18:01 +0000 Subject: TUSCANY-3921: attemot to ensure that dependentContributions doesn't contain duplicates git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1158729 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/tuscany/sca/impl/NodeImpl.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'sca-java-2.x/trunk/modules/domain-node/src/main') diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java index e397fd219b..a0889ee9d3 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java @@ -434,24 +434,28 @@ public class NodeImpl implements Node { } protected List calculateDependentContributions(ContributionDescription cd) throws ContributionReadException, ValidationException { - List dependentContributions = new ArrayList(); + Map dependentContributions = new HashMap(); if (cd.getDependentContributionURIs() != null && cd.getDependentContributionURIs().size() > 0) { // if the install specified dependent uris use just those contributions for (String uri : cd.getDependentContributionURIs()) { - ContributionDescription dependee = domainRegistry.getInstalledContribution(uri); - if (dependee != null) { - dependentContributions.add(loadContribution(dependee)); + if (!!!dependentContributions.containsKey(uri)) { + ContributionDescription dependee = domainRegistry.getInstalledContribution(uri); + if (dependee != null) { + dependentContributions.put(uri, loadContribution(dependee)); + } } } } else { for (Import imprt : loadContribution(cd).getImports()) { for (ContributionDescription exportingIC : findExportingContributions(imprt)) { - dependentContributions.add(loadContribution(exportingIC)); + if (!!!dependentContributions.containsKey(exportingIC.getURI())) { + dependentContributions.put(exportingIC.getURI(), loadContribution(exportingIC)); + } } } } // TODO: there is also the location attribute on the import which should be taken into account - return dependentContributions; + return new ArrayList(dependentContributions.values()); } private List findExportingContributions(Import imprt) { -- cgit v1.2.3