From e25ca89839f794a4d4773fd9bf5dcba407be562c Mon Sep 17 00:00:00 2001 From: lresende Date: Thu, 29 Apr 2010 04:49:29 +0000 Subject: 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 --- .../tuscany/sca/core/context/impl/ComponentContextImpl.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'sca-java-2.x/trunk/modules/core/src') 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 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) { -- cgit v1.2.3