You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by bd...@apache.org on 2010/08/05 18:59:31 UTC

svn commit: r982693 - /tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java

Author: bdaniel
Date: Thu Aug  5 16:59:31 2010
New Revision: 982693

URL: http://svn.apache.org/viewvc?rev=982693&view=rev
Log:
Throw an IllegalArgumentException if createSelfReference is called with a businessInterface that is not valid for any service in the component (JCA-9011)

Modified:
    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java

Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java?rev=982693&r1=982692&r2=982693&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java Thu Aug  5 16:59:31 2010
@@ -256,6 +256,8 @@ public class ComponentContextImpl implem
         ComponentService service = getSingleService(component);
         try {
             return createSelfReference(businessInterface, service);
+        } catch (IllegalArgumentException iae) {
+        	throw iae;
         } catch (Exception e) {
             throw new ServiceRuntimeException(e.getMessage(), e);
         }
@@ -301,6 +303,8 @@ public class ComponentContextImpl implem
                 (RuntimeEndpointReference)createEndpointReference(component, service, null, businessInterface);
             ref.setComponent(component);
             return getServiceReference(businessInterface, ref);
+        } catch (IllegalArgumentException iae) {
+        	throw iae;
         } catch (Exception e) {
             throw new ServiceRuntimeException(e);
         }
@@ -465,7 +469,8 @@ public class ComponentContextImpl implem
         }
         
         if(!compatible) {
-        	interfaceContract = null;
+        	// JCA-9011
+        	throw new IllegalArgumentException("Business interface " + businessInterface.getName() + " is not compatible with " + interfaceContract.getInterface().getClass().getName());
         }
 
         return interfaceContract;