summaryrefslogtreecommitdiffstats
path: root/java/sca/modules
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-08-25 13:31:34 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-08-25 13:31:34 +0000
commita000967da541dc7f51c0380a000f09846c88f739 (patch)
treeb153ef0228355d6fa47beb67b3a8afac139c0c8d /java/sca/modules
parent5fffa71fd0463ddbb6beef30a4ad334e6d4c7ba8 (diff)
Fix TUSCANY-3231 and ASM_5029, spot that property with many=false has multiple value elements
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@807619 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
-rw-r--r--java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java8
-rw-r--r--java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java2
-rw-r--r--java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java4
-rw-r--r--java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java2
4 files changed, 11 insertions, 5 deletions
diff --git a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
index bab3b94ba4..0c0614ef8a 100644
--- a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
+++ b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
@@ -514,7 +514,7 @@ abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor {
* @throws ContributionReadException
* @throws ParserConfigurationException
*/
- protected Document readPropertyValue(QName element, QName type, XMLStreamReader reader) throws XMLStreamException,
+ protected Document readPropertyValue(QName element, QName type, boolean isMany, XMLStreamReader reader) throws XMLStreamException,
ContributionReadException {
Document document;
try {
@@ -565,6 +565,7 @@ abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor {
valueElement.setTextContent(valueAttr);
}
+ boolean gotOneValue = false;
boolean isTextForProperty = true;
StringBuffer text = new StringBuffer();
@@ -587,7 +588,12 @@ abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor {
}
// Read <value>
if (VALUE_QNAME.equals(name)) {
+ if (gotOneValue && !isMany) {
+ // TODO: TUSCANY-3231 this should be error not warning but that breaks OASIS tests
+ warning("ASM50032: multiple value elements for single-valued property", name, name);
+ }
loadElement(reader, root);
+ gotOneValue = true;
} else {
// Global elements
loadElement(reader, root);
diff --git a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
index 0ea78177ff..aee2d89b7c 100644
--- a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
+++ b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
@@ -140,7 +140,7 @@ public class ComponentTypeProcessor extends BaseAssemblyProcessor implements StA
policyProcessor.readPolicies(property, reader);
// Read the property value
- Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), reader);
+ Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), property.isMany(), reader);
property.setValue(value);
componentType.getProperties().add(property);
diff --git a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
index 581901a32e..d47059bac5 100644
--- a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
+++ b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
@@ -369,7 +369,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
readAbstractProperty(componentProperty, reader);
// Read the property value
- Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), reader);
+ Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), property.isMany(), reader);
property.setValue(value);
component.getProperties().add(componentProperty);
@@ -381,7 +381,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
readAbstractProperty(property, reader);
// Read the property value
- Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), reader);
+ Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), property.isMany(), reader);
property.setValue(value);
composite.getProperties().add(property);
diff --git a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java
index 34c4bc9909..bf53be5dfa 100644
--- a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java
+++ b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java
@@ -127,7 +127,7 @@ public class ConstrainingTypeProcessor extends BaseAssemblyProcessor implements
readAbstractProperty(abstractProperty, reader);
// Read the property value
- Document value = readPropertyValue(abstractProperty.getXSDElement(), abstractProperty.getXSDType(), reader);
+ Document value = readPropertyValue(abstractProperty.getXSDElement(), abstractProperty.getXSDType(), abstractProperty.isMany(), reader);
abstractProperty.setValue(value);
constrainingType.getProperties().add(abstractProperty);