Buggy code:
} for ( AttributeDefinition simpleAttribute : CommonAttributes . SIMPLE_ROOT_RESOURCE_ATTRIBUTES ) { simpleAttribute . marshallAsElement ( node , writer ) ; } MessagingSubsystemParser . writeConnectors ( writer , node ) ; MessagingSubsystemParser . writeAcceptors ( writer , node ) ; if ( node . hasDefined ( CommonAttributes . BROADCAST_GROUP ) ) { writeBroadcastGroups ( writer , node . get ( CommonAttributes . BROADCAST_GROUP ) ) ; } if ( node . hasDefined ( CommonAttributes . DISCOVERY_GROUP ) ) { writeDiscoveryGroups ( writer , node . get ( CommonAttributes . DISCOVERY_GROUP ) ) ; } if ( node . hasDefined ( CommonAttributes . DIVERT ) ) { writeDiverts ( writer , node . get ( CommonAttributes . DIVERT ) ) ; } if ( node . hasDefined ( QUEUE ) ) { writeQueues ( writer , node . get ( QUEUE ) ) ; } if ( node . hasDefined ( BRIDGE ) ) { writeBridges ( writer , node . get ( BRIDGE ) ) ; } if ( node . hasDefined ( CLUSTER_CONNECTION ) ) { writeClusterConnections ( writer , node . get ( CLUSTER_CONNECTION ) ) ; } if ( node . hasDefined ( GROUPING_HANDLER ) ) { writeGroupingHandler ( writer , node . get ( CommonAttributes . GROUPING_HANDLER ) ) ; } final ModelNode paths = node . get ( PATH ) ; if ( paths . hasDefined ( PAGING_DIRECTORY ) ) { MessagingSubsystemParser . writeDirectory ( writer , Element . PAGING_DIRECTORY , node . get ( PATH ) ) ; } if ( paths . hasDefined ( CommonAttributes . BINDINGS_DIRECTORY ) ) { MessagingSubsystemParser . writeDirectory ( writer , BINDINGS_DIRECTORY , node . get ( PATH ) ) ; } if ( paths . hasDefined ( JOURNAL_DIRECTORY ) ) { MessagingSubsystemParser . writeDirectory ( writer , Element . JOURNAL_DIRECTORY , node . get ( PATH ) ) ; } if ( paths . hasDefined ( LARGE_MESSAGES_DIRECTORY ) ) { MessagingSubsystemParser . writeDirectory ( writer , Element . LARGE_MESSAGES_DIRECTORY , node . get ( PATH ) ) ; } if ( node . hasDefined ( SECURITY_SETTING ) ) { writeSecuritySettings ( writer , node . get ( SECURITY_SETTING ) ) ; } if ( node . hasDefined ( CommonAttributes . ADDRESS_SETTING ) ) { writeAddressSettings ( writer , node . get ( CommonAttributes . ADDRESS_SETTING ) ) ; } if ( node . hasDefined ( CONNECTOR_SERVICE ) ) { writeConnectorServices ( writer , node . get ( CONNECTOR_SERVICE ) ) ; } if ( ( node . hasDefined ( CommonAttributes . CONNECTION_FACTORY ) ) || ( node . hasDefined ( CommonAttributes . POOLED_CONNECTION_FACTORY ) ) ) { ModelNode cf = node . get ( CommonAttributes . CONNECTION_FACTORY ) ; ModelNode pcf = node . get ( CommonAttributes . POOLED_CONNECTION_FACTORY ) ; boolean hasCf = ( cf . isDefined ( ) ) && ( ( cf . keys ( ) . size ( ) ) > 0 ) ; boolean hasPcf = ( cf . isDefined ( ) ) && ( ( cf . keys ( ) . size ( ) ) > 0 ) ; if ( hasCf || hasPcf ) { writer . writeStartElement ( CommonAttributes . JMS_CONNECTION_FACTORIES ) ; if ( hasCf ) { writeConnectionFactories ( writer , cf ) ; } if ( hasPcf ) { writePooledConnectionFactories ( writer , pcf ) ; } writer . writeEndElement ( ) ; } } if ( ( node . has ( CommonAttributes . JMS_QUEUE ) ) || ( node . has ( CommonAttributes . JMS_TOPIC ) ) ) { ModelNode queue = node . get ( CommonAttributes . JMS_QUEUE ) ; ModelNode topic = node . get ( CommonAttributes . JMS_TOPIC ) ; boolean hasQueue = ( queue . isDefined ( ) ) && ( ( queue . keys ( ) . size ( ) ) > 0 ) ; boolean hasTopic = ( topic . isDefined ( ) ) && ( ( topic . keys ( ) . size ( ) ) > 0 ) ; <START_BUG> if ( hasQueue && hasTopic ) { <END_BUG> writer . writeStartElement ( CommonAttributes . JMS_DESTINATIONS ) ; if ( hasQueue ) { writeJmsQueues ( writer , node . get ( CommonAttributes . JMS_QUEUE ) ) ; } if ( hasTopic ) { writeTopics ( writer , node . get ( CommonAttributes . JMS_TOPIC ) ) ; } writer . writeEndElement ( ) ; } } writer . writeEndElement ( ) ; } private void writeConnectorServices ( XMLExtendedStreamWriter writer , ModelNode node ) throws XMLStreamException { } private void writeBridges ( XMLExtendedStreamWriter writer , ModelNode node ) throws XMLStreamException { } private void writeClusterConnections ( XMLExtendedStreamWriter writer , ModelNode node ) throws XMLStreamException { } private void writeGroupingHandler ( XMLExtendedStreamWriter writer , ModelNode node ) throws XMLStreamException { } static void writeAcceptors ( final XMLExtendedStreamWriter writer , final ModelNode node ) throws XMLStreamException { } static void writeConnectors ( final XMLExtendedStreamWriter writer , final ModelNode node ) throws XMLStreamException { } static void writeAcceptorAndConnectorContent ( final XMLExtendedStreamWriter writer , final Property property ) throws XMLStreamException { } private void writeSecuritySettings ( final XMLExtendedStreamWriter writer , final ModelNode node ) throws XMLStreamException { } private void writePermission ( final XMLExtendedStreamWriter writer , final String type , final List < String > roles ) throws XMLStreamException { } private void writeAddressSettings ( final XMLExtendedStreamWriter writer , final ModelNode node ) throws XMLStreamException { } private void writeQueues ( final XMLExtendedStreamWriter writer , final ModelNode node ) throws XMLStreamException { } private void writeBroadcastGroups ( final XMLExtendedStreamWriter writer , final ModelNode node ) throws XMLStreamException { } private void writeDiscoveryGroups ( final XMLExtendedStreamWriter writer , final ModelNode node ) throws XMLStreamException { } private void writeDiverts ( final XMLExtendedStreamWriter writer , final ModelNode node ) throws XMLStreamException { } private void writeFilter ( final XMLExtendedStreamWriter writer , final ModelNode node ) throws XMLStreamException { }

Fix:
if ( hasQueue || hasTopic ) {