summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68>2010-08-05 16:59:31 +0000
committerbdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68>2010-08-05 16:59:31 +0000
commitcbaa47ea3785db646625272b8110519cf591728d (patch)
tree26197891e80fb43149b9c1cc16ebf9fbed53c482
parentae74f29c776eedeaee681495c5d7ff3bb84e0c04 (diff)
Throw an IllegalArgumentException if createSelfReference is called with a businessInterface that is not valid for any service in the component (JCA-9011)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@982693 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java
index a246393803..bf74482a1e 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java
@@ -256,6 +256,8 @@ public class ComponentContextImpl implements RuntimeComponentContext {
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 implements RuntimeComponentContext {
(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 implements RuntimeComponentContext {
}
if(!compatible) {
- interfaceContract = null;
+ // JCA-9011
+ throw new IllegalArgumentException("Business interface " + businessInterface.getName() + " is not compatible with " + interfaceContract.getInterface().getClass().getName());
}
return interfaceContract;