You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2010/02/20 09:38:36 UTC
svn commit: r912090 -
/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
Author: lresende
Date: Sat Feb 20 08:38:36 2010
New Revision: 912090
URL: http://svn.apache.org/viewvc?rev=912090&view=rev
Log:
TUSCANY-3468 - Fixing NPE when contracts are not available (e.g in implementation widget)
Modified:
tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java?rev=912090&r1=912089&r2=912090&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java Sat Feb 20 08:38:36 2010
@@ -258,7 +258,7 @@
// 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 @@
}
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