[jboss-jira] [JBoss JIRA] (WFCORE-1824) Can not parse object attributes that contains a Properties attribute

Jeff Mesnil (JIRA) issues at jboss.org
Mon Sep 26 08:31:01 EDT 2016


Jeff Mesnil created WFCORE-1824:
-----------------------------------

             Summary: Can not parse object attributes that contains a Properties attribute
                 Key: WFCORE-1824
                 URL: https://issues.jboss.org/browse/WFCORE-1824
             Project: WildFly Core
          Issue Type: Bug
          Components: Domain Management
    Affects Versions: 3.0.0.Alpha8
            Reporter: Jeff Mesnil
            Assignee: Brian Stansberry


My resource defines an attribute which is a LIST of OBJECT that corresponds to a class (class name + module) and Properties that are passed to the created instance:

{noformat}
    private static final String CLASS = "class";
    private static final String MODULE = "module";
    public static final PropertiesAttributeDefinition PROPERTIES = new PropertiesAttributeDefinition.Builder("properties", true)
            .setAllowExpression(true)
            .build();

    public static final ObjectTypeAttributeDefinition PROCESS_STATE_LISTENER = ObjectTypeAttributeDefinition.Builder.of("process-state-listener",
            SimpleAttributeDefinitionBuilder.create(CLASS, ModelType.STRING, false)
                    .setAllowExpression(false)
                    .build(),
            SimpleAttributeDefinitionBuilder.create(MODULE, ModelType.STRING, false)
                    .setAllowExpression(false)
                    .build(),
            PROPERTIES)
            .setRestartAllServices()
            .setAllowNull(true)
            .build();
    public static final AttributeDefinition PROCESS_STATE_LISTENERS = ObjectListAttributeDefinition.Builder.of("listeners", PROCESS_STATE_LISTENER)
            .setAllowNull(false)
            .setRuntimeServiceNotRequired()
            .build();
{noformat}

I can create the resource from the CLI:

{noformat}
 /subsystem=core-management/service=process-state-listeners:add(listeners=[{class=org.foo.Listener, module=org.foo,, properties = {foo  = true, bar  = ${bar.prop:2}}}])
{"outcome" => "success"}
{noformat}

And the resource and its attribute is properly marshalled to the XML configuration:

{noformat}
            <process-state-listeners>
                <listeners>
                    <process-state-listener class="org.foo.Listener" module="org.foo">
                        <properties>
                            <property name="foo" value="true"/>
                            <property name="bar" value="${bar.prop:2}"/>
                        </properties>
                    </process-state-listener>
                </listeners>
            </process-state-listeners>
{noformat}

However the resource can not be parsed and it fails with the exception:

{noformat}
boss.as.server.parsing.StandaloneXml_5.readElement(StandaloneXml_5.java:144)
        at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:107)
        at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:49)
        at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110)
        at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69)
        at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:123)
        ... 3 more

09:45:00,537 FATAL [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.{noformat}

The code in org.jboss.as.controller.AttributeParser#parseElement:197 to parse a list of objects assumes that the object's value are all represented by XML attributes. In my case, that's not correct as the "properties" attribute is represented by XML elements.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list