Buggy code:
public class InfinispanSubsystemXMLWriter implements XMLElementWriter < SubsystemMarshallingContext > { public static final XMLElementWriter < SubsystemMarshallingContext > INSTANCE = new InfinispanSubsystemXMLWriter ( ) ; @ Override public void writeContent ( XMLExtendedStreamWriter writer , SubsystemMarshallingContext context ) throws XMLStreamException { context . startSubsystemElement ( CURRENT . getUri ( ) , false ) ; ModelNode model = context . getModelNode ( ) ; if ( model . isDefined ( ) ) { for ( Property entry : model . get ( CACHE_CONTAINER ) . asPropertyList ( ) ) { String containerName = entry . getName ( ) ; ModelNode container = entry . getValue ( ) ; writer . writeStartElement ( Element . CACHE_CONTAINER . getLocalName ( ) ) ; writer . writeAttribute ( NAME . getLocalName ( ) , containerName ) ; this . writeAliases ( writer , ALIASES , container , ModelKeys . ALIASES ) ; this . writeOptional ( writer , DEFAULT_CACHE , container , ModelKeys . DEFAULT_CACHE ) ; this . writeOptional ( writer , EVICTION_EXECUTOR , container , ModelKeys . EVICTION_EXECUTOR ) ; this . writeOptional ( writer , JNDI_NAME , container , ModelKeys . JNDI_NAME ) ; this . writeOptional ( writer , LISTENER_EXECUTOR , container , ModelKeys . LISTENER_EXECUTOR ) ; this . writeOptional ( writer , REPLICATION_QUEUE_EXECUTOR , container , ModelKeys . REPLICATION_QUEUE_EXECUTOR ) ; this . writeOptional ( writer , START , container , ModelKeys . START ) ; this . writeOptional ( writer , MODULE , container , ModelKeys . MODULE ) ; if ( container . hasDefined ( TRANSPORT ) ) { writer . writeStartElement ( Element . TRANSPORT . getLocalName ( ) ) ; ModelNode transport = container . get ( TRANSPORT , TRANSPORT_NAME ) ; this . writeOptional ( writer , STACK , transport , ModelKeys . STACK ) ; this . writeOptional ( writer , CLUSTER , transport , ModelKeys . CLUSTER ) ; this . writeOptional ( writer , EXECUTOR , transport , ModelKeys . EXECUTOR ) ; this . writeOptional ( writer , LOCK_TIMEOUT , transport , ModelKeys . LOCK_TIMEOUT ) ; writer . writeEndElement ( ) ; } if ( container . get ( LOCAL_CACHE ) . isDefined ( ) ) { for ( Property localCacheEntry : container . get ( LOCAL_CACHE ) . asPropertyList ( ) ) { String localCacheName = localCacheEntry . getName ( ) ; ModelNode localCache = localCacheEntry . getValue ( ) ; writer . writeStartElement ( Element . LOCAL_CACHE . getLocalName ( ) ) ; writer . writeAttribute ( NAME . getLocalName ( ) , localCacheName ) ; processCommonCacheAttributesElements ( writer , localCache ) ; writer . writeEndElement ( ) ; } } if ( container . get ( INVALIDATION_CACHE ) . isDefined ( ) ) { for ( Property invalidationCacheEntry : container . get ( INVALIDATION_CACHE ) . asPropertyList ( ) ) { String invalidationCacheName = invalidationCacheEntry . getName ( ) ; ModelNode invalidationCache = invalidationCacheEntry . getValue ( ) ; writer . writeStartElement ( Element . INVALIDATION_CACHE . getLocalName ( ) ) ; writer . writeAttribute ( NAME . getLocalName ( ) , invalidationCacheName ) ; processCommonClusteredCacheAttributes ( writer , invalidationCache ) ; processCommonCacheAttributesElements ( writer , invalidationCache ) ; writer . writeEndElement ( ) ; } } if ( container . get ( REPLICATED_CACHE ) . isDefined ( ) ) { for ( Property replicatedCacheEntry : container . get ( REPLICATED_CACHE ) . asPropertyList ( ) ) { String replicatedCacheName = replicatedCacheEntry . getName ( ) ; ModelNode replicatedCache = replicatedCacheEntry . getValue ( ) ; writer . writeStartElement ( Element . REPLICATED_CACHE . getLocalName ( ) ) ; writer . writeAttribute ( NAME . getLocalName ( ) , replicatedCacheName ) ; processCommonClusteredCacheAttributes ( writer , replicatedCache ) ; processCommonCacheAttributesElements ( writer , replicatedCache ) ; writer . writeEndElement ( ) ; } } if ( container . get ( DISTRIBUTED_CACHE ) . isDefined ( ) ) { for ( Property distributedCacheEntry : container . get ( DISTRIBUTED_CACHE ) . asPropertyList ( ) ) { String distributedCacheName = distributedCacheEntry . getName ( ) ; ModelNode distributedCache = distributedCacheEntry . getValue ( ) ; writer . writeStartElement ( Element . DISTRIBUTED_CACHE . getLocalName ( ) ) ; writer . writeAttribute ( NAME . getLocalName ( ) , distributedCacheName ) ; this . writeOptional ( writer , OWNERS , distributedCache , ModelKeys . OWNERS ) ; <START_BUG> this . writeOptional ( writer , VIRTUAL_NODES , distributedCache , ModelKeys . VIRTUAL_NODES ) ; <END_BUG> this . writeOptional ( writer , L1_LIFESPAN , distributedCache , ModelKeys . L1_LIFESPAN ) ; processCommonClusteredCacheAttributes ( writer , distributedCache ) ; processCommonCacheAttributesElements ( writer , distributedCache ) ; writer . writeEndElement ( ) ; } } writer . writeEndElement ( ) ; } } writer . writeEndElement ( ) ; } private void processCommonClusteredCacheAttributes ( XMLExtendedStreamWriter writer , ModelNode cache ) throws XMLStreamException { } private void processCommonCacheAttributesElements ( XMLExtendedStreamWriter writer , ModelNode cache ) throws XMLStreamException { } private void writeAliases ( XMLExtendedStreamWriter writer , Attribute attribute , ModelNode container , String key ) throws XMLStreamException { } private void writeJDBCStoreTable ( XMLExtendedStreamWriter writer , Element element , ModelNode store , String key ) throws XMLStreamException { } private void writeJDBCStoreColumn ( XMLExtendedStreamWriter writer , Element element , ModelNode table , String key ) throws XMLStreamException { } private void writeStoreAttributes ( XMLExtendedStreamWriter writer , ModelNode store ) throws XMLStreamException { } private void writeStoreWriteBehind ( XMLExtendedStreamWriter writer , ModelNode store ) throws XMLStreamException { } private void writeStoreProperties ( XMLExtendedStreamWriter writer , ModelNode store ) throws XMLStreamException { } private void writeOptional ( XMLExtendedStreamWriter writer , Attribute attribute , ModelNode model , String key ) throws XMLStreamException { } private void writeRequired ( XMLExtendedStreamWriter writer , Attribute attribute , ModelNode model , String key ) throws XMLStreamException { } }

Fix:
this . writeOptional ( writer , SEGMENTS , distributedCache , ModelKeys . SEGMENTS ) ;