From e2a82e1954ef1ac97c26d4f6bca4184494b541b9 Mon Sep 17 00:00:00 2001 From: slaws Date: Fri, 9 Oct 2009 17:59:57 +0000 Subject: TUSCANY-3258 raise an error when a component property type doesn't match the component type property type. This may need to be looked at further if we decide to consider if the types are compatible. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@823643 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/builder/impl/ComponentBuilderImpl.java | 27 ++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'java/sca/modules/builder/src/main') diff --git a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java index 76d5a850d1..971a64c91b 100644 --- a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java +++ b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java @@ -568,8 +568,6 @@ public class ComponentBuilderImpl { componentTypeProperty.setValue(componentProperty.getValue()); } - - // Check that a component property does not override the // many attribute if (!componentTypeProperty.isMany() && componentProperty.isMany()) { @@ -601,6 +599,31 @@ public class ComponentBuilderImpl { component.getName(), componentProperty.getName()); } + + // check that the types specified in the component type and component property match + if ( componentProperty.getXSDElement() != null && + !componentProperty.getXSDElement().equals(componentTypeProperty.getXSDElement())){ + Monitor.error(monitor, + this, + Messages.ASSEMBLY_VALIDATION, + "PropertXSDElementsDontMatch", + component.getName(), + componentProperty.getName(), + componentProperty.getXSDElement().toString(), + componentTypeProperty.getXSDElement().toString()); + } + + if ( componentProperty.getXSDType() != null && + !componentProperty.getXSDType().equals(componentTypeProperty.getXSDType())){ + Monitor.error(monitor, + this, + Messages.ASSEMBLY_VALIDATION, + "PropertXSDTypesDontMatch", + component.getName(), + componentProperty.getName(), + componentProperty.getXSDType().toString(), + componentTypeProperty.getXSDType().toString()); + } } } -- cgit v1.2.3