summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/core/src/main
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2010-04-29 04:49:29 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2010-04-29 04:49:29 +0000
commite25ca89839f794a4d4773fd9bf5dcba407be562c (patch)
treee76e2bbe1caacb0a7533cf1e4c93b33d975291b4 /sca-java-2.x/trunk/modules/core/src/main
parentc093c7a26446ff855552beabe20b307c1be1cc63 (diff)
TUSCANY-3543 - Return first available binding when creating selfReference with multiple bindings and no default one specified
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@939191 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/core/src/main')
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java
index 7a45c25982..470ed168cc 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java
@@ -159,14 +159,21 @@ public class ComponentContextImpl implements RuntimeComponentContext {
// The default binding name is the name of the promoted service
bindingName = getPromotedService(service).getName();
}
+ Endpoint returnEp = null;
List<Endpoint> eps = service.getEndpoints();
for (Endpoint ep : eps) {
Binding binding = ep.getBinding();
if (bindingName.equals(binding.getName()) || binding.getName() == null) {
- return ep;
+ returnEp = ep;
+ break;
}
}
- return null;
+ //TUSCANY-3543
+ if(returnEp == null) {
+ returnEp = eps.get(0);
+ }
+
+ return returnEp;
}
private ComponentService getPromotedService(ComponentService componentService) {