summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2012-07-31 22:36:24 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2012-07-31 22:36:24 +0000
commit8f0f0529eda706c64a156b0df83817bdc9afa79f (patch)
tree394ddad92541413b2415437baef7981365f18ddf /sca-java-2.x/trunk
parente3bfcce9ec733bdc6d42616b0b1a53a78a7681d6 (diff)
Avoid NPE for the remote endpoints which don't have interface contracts set
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1367808 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk')
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java2
-rw-r--r--sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/RemoteEndpointsProcessor.java12
2 files changed, 13 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
index 395d154779..a206a7d161 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
@@ -1089,7 +1089,7 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
InterfaceContract endpointReferenceContract = endpointReference.getReference().getInterfaceContract();
InterfaceContract endpointContract = endpoint.getComponentServiceInterfaceContract();
- if (endpointReferenceContract == null){
+ if (endpointReferenceContract == null || endpointContract == null){
matchAudit.append("Match because there is no interface contract on the reference ");
matchAudit.appendSeperator();
return true;
diff --git a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/RemoteEndpointsProcessor.java b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/RemoteEndpointsProcessor.java
index 640b84119b..174bee4139 100644
--- a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/RemoteEndpointsProcessor.java
+++ b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/RemoteEndpointsProcessor.java
@@ -41,6 +41,8 @@ import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.policy.PolicySet;
/**
@@ -96,8 +98,18 @@ public class RemoteEndpointsProcessor extends BaseAssemblyProcessor implements S
for (ComponentService service : component.getServices()) {
for (Binding binding : service.getBindings()) {
Endpoint endpoint = assemblyFactory.createEndpoint();
+ endpoint.setRemote(true);
endpoint.setComponent(component);
endpoint.setService(service);
+ /*
+ if (service.getInterfaceContract() == null) {
+ JavaInterfaceFactory interfaceFactory =
+ modelFactories(registry).getFactory(JavaInterfaceFactory.class);
+ JavaInterfaceContract contract = interfaceFactory.createJavaInterfaceContract();
+ contract.setInterface(interfaceFactory.createJavaInterface());
+ service.setInterfaceContract(contract);
+ }
+ */
endpoint.setBinding(binding);
// retrieve the stash of intents and policy sets from the component