summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/assembly-xml/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/modules/assembly-xml/src')
-rw-r--r--java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java14
-rw-r--r--java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/policy/xml/policy-xml-validation-messages.properties1
2 files changed, 14 insertions, 1 deletions
diff --git a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java
index 49960cf6e8..12767ed55c 100644
--- a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java
+++ b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java
@@ -159,7 +159,19 @@ public class IntentProcessor extends BaseStAXArtifactProcessor implements StAXAr
intent.getName().toString());
}
}
- intent.getQualifiedIntents().add(qualified);
+
+ // check that the qualifier is unique
+ if ( !intent.getQualifiedIntents().contains(qualified)){
+ intent.getQualifiedIntents().add(qualified);
+ } else {
+ Monitor.error(context.getMonitor(),
+ this,
+ Messages.RESOURCE_BUNDLE,
+ "QualifierIsNotUnique",
+ intent.getName().toString(),
+ qualifierName);
+ }
+
qualified.setQualifiableIntent(intent);
current = qualified;
}
diff --git a/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/policy/xml/policy-xml-validation-messages.properties b/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/policy/xml/policy-xml-validation-messages.properties
index 6fb369f73f..105158b986 100644
--- a/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/policy/xml/policy-xml-validation-messages.properties
+++ b/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/policy/xml/policy-xml-validation-messages.properties
@@ -43,4 +43,5 @@ IntentMapProvidesMissing = Required attribute "provides" missing for IntentMap i
QualifierNameMissing = Required attribute "name" missing for qualifier definition in PolicySet : {0}
ConstrainedTypeNotFound = Unable to find the extension type {0} constrained by intent: {1}
MultipleDefaultQualifiers = [POL30004] Intent {0} has more than one qualifier marked as the default qualifier
+QualifierIsNotUnique = [POL30005] The intent {0} has more than one qualifier with the name {1}