-
Bug
-
Resolution: Done
-
Major
-
1.0.0.Alpha3
-
None
The AttributeDefinition.convertParameterExpression method is called before the validator has validated the model node. This is because the conversion is part of doing any configured "cleanup" of the node before validation. (See AS7-6224.)
MapAttributeDefinition and ListAttributeDefinition break this in their overrides of the method by doing unsafe type conversions. When these fail, users get unfriendly failure messages instead of the ones that the validators would provide.
For example, this bogus CLI command:
[standalone@localhost:9990 /] /subsystem=datasources/data-source=ExampleDS:write-attribute(name=valid-connection-checker-properties, value=1)
Produces this in the server log:
15:46:42,167 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 4) WFLYCTL0013: Operation ("write-attribute") failed - address: ([ ("subsystem" => "datasources"), ("data-source" => "ExampleDS") ]): java.lang.IllegalArgumentException at org.jboss.dmr.ModelValue.asPropertyList(ModelValue.java:100) [jboss-dmr-1.2.0.Final.jar:1.2.0.Final] at org.jboss.dmr.ModelNode.asPropertyList(ModelNode.java:384) [jboss-dmr-1.2.0.Final.jar:1.2.0.Final] at org.jboss.as.controller.MapAttributeDefinition.convertParameterExpressions(MapAttributeDefinition.java:252) [wildfly-controller-1.0.0.Alpha2.jar:1.0.0.Alpha2] at org.jboss.as.controller.AttributeDefinition.validateAndSet(AttributeDefinition.java:439) [wildfly-controller-1.0.0.Alpha2.jar:1.0.0.Alpha2] at org.jboss.as.controller.AbstractWriteAttributeHandler.execute(AbstractWriteAttributeHandler.java:88) [wildfly-controller-1.0.0.Alpha2.jar:1.0.0.Alpha2] at org.jboss.as.controller.operations.global.WriteAttributeHandler.execute(WriteAttributeHandler.java:98) [wildfly-controller-1.0.0.Alpha2.jar:1.0.0.Alpha2]
There should be nothing in the server log at all for that error; the validator should have caught it and generated an appropriate failure response to the client.