Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-5837

AttributeMarshallers.SimpleListAttributeMarshaller needs to flag isMarshallableAsElement as true

    XMLWordPrintable

Details

    Description

      I haveĀ a long string value that I want to persist the XML configuration like:

      <test>
          <x>Long string value that does not fit as attribute</x>
          <x>The element value should be more appropriate.</x>
      </test>
      

      So I tried with

      AttributeDefinition ad = SimpleAttributeDefinitionBuilder.create("x", ModelType.STRING).build();
      SimpleListAttributeDefinition attributeDefinition = SimpleListAttributeDefinition.Builder.of("test", ad).build();
      

      then I got:

      java.lang.UnsupportedOperationException: WFLYCTL0284: Could not marshal attribute as attribute: test
      	at org.jboss.as.controller.AttributeMarshaller.marshallAsAttribute(AttributeMarshaller.java:79)
      	at org.jboss.as.controller.AttributeMarshaller.marshall(AttributeMarshaller.java:95)
      

      Looking inside of the SimpleListAttributeDefinition, I see it uses AttributeMarshallers.SimpleListAttributeMarshaller internally which implements only marshallAsElement method, but leaving isMarshallableAsElement un-implemented which returns false by default.

      Attachments

        Activity

          People

            rhn-engineering-lgao Lin Gao
            rhn-engineering-lgao Lin Gao
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: