summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java16
-rw-r--r--java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties3
2 files changed, 10 insertions, 9 deletions
diff --git a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java
index 1f8fbd2d21..b9c6516a68 100644
--- a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java
+++ b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java
@@ -50,14 +50,14 @@ public class CompositeModelResolver implements ModelResolver {
public void addModel(Object resolved) {
Composite composite = (Composite)resolved;
- if (map.containsKey(composite.getName())){
- Monitor.error(monitor,
- this,
- "assembly-validation-messages",
- "DuplicateCompositeName",
- composite.getName().toString());
- } else {
- map.put(composite.getName(), composite);
+ Composite old = map.put(composite.getName(), composite);
+ if (old != null) {
+ Monitor.error(monitor,
+ this,
+ "assembly-xml-validation-messages",
+ "DuplicateCompositeName",
+ composite.getName().toString(),
+ contribution.getLocation());
}
}
diff --git a/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties b/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties
index 8e80fd8231..94e462fc96 100644
--- a/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties
+++ b/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties
@@ -27,4 +27,5 @@ PolicyServiceValidationException = PolicyValidation exceptions when processing s
ContributionReadException = ContributionReadException occured due to : {0}
ContributionWriteException = ContributionWriteException occured due to : {0}
XMLStreamException = XMLStreamException occured due to : {0}
-DuplicateCompositeName = Found more than one composite with the name : {0}
+DuplicateCompositeName = [ASM_6001] More than one composite with the same name {0} found in contribution {1}
+