diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-20 08:38:36 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-20 08:38:36 +0000 |
commit | d8eded9182740e8ece9d24331d5d9a4d4e13ab73 (patch) | |
tree | 47a727501972279ada489438d65b493ea0e0e490 | |
parent | 605c02059fa742baf066084f6a554cc36d75975b (diff) |
TUSCANY-3468 - Fixing NPE when contracts are not available (e.g in implementation widget)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@912090 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java index 6dc8e63c17..940155d613 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java @@ -258,7 +258,7 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen // TODO - EPR why is this looking at the component types. The endpoint should have the right interface contract by this time //InterfaceContract targetContract = getLeafInterfaceContract(endpoint); - if (sourceContract == null) { + if (sourceContract == null && targetContract != null) { // TODO: until the web component introspection is brought up try { sourceContract = (InterfaceContract)targetContract.clone(); @@ -268,22 +268,24 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen } List<InvocationChain> chainList = new ArrayList<InvocationChain>(); - RuntimeComponentReference reference = (RuntimeComponentReference)getReference(); - for (Operation operation : sourceContract.getInterface().getOperations()) { - Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation); - if (targetOperation == null) { - throw new ServiceRuntimeException("No matching operation for " + operation.getName() - + " is found in reference " - + getComponent().getURI() - + "#" - + reference.getName()); - } - InvocationChain chain = new InvocationChainImpl(operation, targetOperation, true, phaseManager); - if (operation.isNonBlocking()) { - addNonBlockingInterceptor(chain); - } - chainList.add(chain); - addReferenceBindingInterceptor(chain, operation); + if(sourceContract != null && targetContract != null) { + RuntimeComponentReference reference = (RuntimeComponentReference)getReference(); + for (Operation operation : sourceContract.getInterface().getOperations()) { + Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation); + if (targetOperation == null) { + throw new ServiceRuntimeException("No matching operation for " + operation.getName() + + " is found in reference " + + getComponent().getURI() + + "#" + + reference.getName()); + } + InvocationChain chain = new InvocationChainImpl(operation, targetOperation, true, phaseManager); + if (operation.isNonBlocking()) { + addNonBlockingInterceptor(chain); + } + chainList.add(chain); + addReferenceBindingInterceptor(chain, operation); + } } // Set the chains until it's fully populated. If we initialize too early, any exeception could |