-
Bug
-
Resolution: Done
-
Major
-
3.0.0.Beta8
-
None
Currently, the org.jboss.as.controller.PersistentResourceXMLDescription does not perform any validation when using attribute groups or object type attribute definitions to check how many times an attribute was defined.
For instance, when using a resource description with an attribute group like this:
static final AttributeDefinition clusterAttr1 = create("cluster-attr1", ModelType.STRING) .setAttributeGroup("cluster") .setXmlName("attr1") .build(); static final AttributeDefinition clusterAttr2 = create("cluster-attr2", ModelType.STRING) .setAttributeGroup("cluster") .setXmlName("attr2") .build();
The parser allows a XML declaration as follows:
<resource name="foo3"> <cluster attr1="bar1" attr2="baz1"/> <cluster attr1="bar2" attr2="baz2"/> </resource>
The declaration does not throws any error and only the second declaration of cluster is populated into the model.
A similar problem exists when using object type attribute definitions as follows:
static final ObjectTypeAttributeDefinition USERS_PROPERTIES = ObjectTypeAttributeDefinition.Builder.of("user-properties", create("path", ModelType.STRING, false) .setAllowExpression(false) .build(), create("relative-to", ModelType.STRING, false) .setAllowExpression(false) .build()) .build();
The parser also allows a declaration as follows:
<object-type-test name="foo5"> <user-properties path="path1" relative-to="relative1"/> <user-properties path="path2" relative-to="relative2"/> </object-type-test>
As a result, only the last user-properties is populated in the model and we don't get any error.