Hi, This change breaks the case where we use @target in the <reference> element to wire components using non-SCA bindings. For example, the RESTBindingInvoker uses the binding.uri to find out the target address. Since now it's a clone, the value won't be updated when the service binding set the deployed URI.
A better fix is to retrieve the deployed URI from the target endpoint. Thanks, Raymond On Mar 19, 2012, at 1:09 AM, antel...@apache.org wrote: > Author: antelder > Date: Mon Mar 19 08:09:04 2012 > New Revision: 1302317 > > URL: http://svn.apache.org/viewvc?rev=1302317&view=rev > Log: > TUSCANY-4029: Clone the binding when setting it on the EndpointReference to > ensure its not the same instance as that used by the Endpoint. > > Modified: > > tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java > > Modified: > tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java > URL: > http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java?rev=1302317&r1=1302316&r2=1302317&view=diff > ============================================================================== > --- > tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java > (original) > +++ > tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java > Mon Mar 19 08:09:04 2012 > @@ -42,7 +42,6 @@ import org.apache.tuscany.sca.assembly.b > import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint; > import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; > import org.apache.tuscany.sca.assembly.builder.PolicyBuilder; > -import org.apache.tuscany.sca.assembly.xml.Messages; > import org.apache.tuscany.sca.core.ExtensionPointRegistry; > import org.apache.tuscany.sca.core.FactoryExtensionPoint; > import org.apache.tuscany.sca.core.UtilityExtensionPoint; > @@ -501,7 +500,12 @@ public class EndpointReferenceBinderImpl > } else { > endpointReference.setTargetEndpoint(matchedEndpoint); > Binding binding = matchedEndpoint.getBinding(); > - endpointReference.setBinding(binding); > + try { > + endpointReference.setBinding((Binding) > binding.clone()); > + } catch (CloneNotSupportedException e) { > + // shouldn't happen > + throw new RuntimeException(e); > + } > // TUSCANY-3873 - add policy from the service > // we don't care about intents at this stage > > endpointReference.getPolicySets().addAll(matchedEndpoint.getPolicySets()); > >