Buggy code:
public class HostXml extends CommonXml { public HostXml ( final ModuleLoader loader ) { } @ Override public void readElement ( final XMLExtendedStreamReader reader , final List < ModelNode > operationList ) throws XMLStreamException { } @ Override public void writeContent ( final XMLExtendedStreamWriter writer , final ModelMarshallingContext context ) throws XMLStreamException { final ModelNode modelNode = context . getModelNode ( ) ; writer . writeStartDocument ( ) ; writer . writeStartElement ( HOST . getLocalName ( ) ) ; <START_BUG> if ( hasDefinedChild ( modelNode , NAME ) ) { <END_BUG> writeAttribute ( writer , Attribute . NAME , modelNode . get ( NAME ) . asString ( ) ) ; } writer . writeDefaultNamespace ( CURRENT . getUriString ( ) ) ; writeNamespaces ( writer , modelNode ) ; writeSchemaLocation ( writer , modelNode ) ; if ( modelNode . hasDefined ( EXTENSION ) ) { writeExtensions ( writer , modelNode . get ( EXTENSION ) ) ; } if ( modelNode . hasDefined ( PATH ) ) { writePaths ( writer , modelNode . get ( PATH ) ) ; } if ( modelNode . hasDefined ( SYSTEM_PROPERTY ) ) { writeProperties ( writer , modelNode . get ( SYSTEM_PROPERTY ) , SYSTEM_PROPERTIES ) ; } if ( modelNode . hasDefined ( MANAGEMENT ) ) { writeManagement ( writer , modelNode . get ( MANAGEMENT ) ) ; } if ( modelNode . hasDefined ( DOMAIN_CONTROLLER ) ) { writeDomainController ( writer , modelNode . get ( DOMAIN_CONTROLLER ) ) ; } if ( modelNode . hasDefined ( INTERFACE ) ) { writeInterfaces ( writer , modelNode . get ( INTERFACE ) ) ; } if ( modelNode . hasDefined ( JVM ) ) { writer . writeStartElement ( JVMS . getLocalName ( ) ) ; for ( final Property jvm : modelNode . get ( JVM ) . asPropertyList ( ) ) { writeJVMElement ( writer , jvm . getName ( ) , jvm . getValue ( ) ) ; } writer . writeEndElement ( ) ; } if ( modelNode . hasDefined ( SERVER_CONFIG ) ) { writeServers ( writer , modelNode . get ( SERVER_CONFIG ) ) ; } writer . writeEndElement ( ) ; writer . writeEndDocument ( ) ; } private void readHostElement ( final XMLExtendedStreamReader reader , final ModelNode address , final List < ModelNode > list ) throws XMLStreamException { } private void setHostName ( final ModelNode address , final List < ModelNode > operationList , final String value ) { } private void parseDomainController ( final XMLExtendedStreamReader reader , final ModelNode address , final List < ModelNode > list ) throws XMLStreamException { } private void parseRemoteDomainController ( final XMLExtendedStreamReader reader , final ModelNode address , final List < ModelNode > list ) throws XMLStreamException { } private void parseJvms ( final XMLExtendedStreamReader reader , final ModelNode address , final List < ModelNode > list ) throws XMLStreamException { } private void parseServers ( final XMLExtendedStreamReader reader , final ModelNode address , final List < ModelNode > list ) throws XMLStreamException { } private void parseServer ( final XMLExtendedStreamReader reader , final ModelNode parentAddress , final List < ModelNode > list , final Set < String > serverNames ) throws XMLStreamException { } private void writeDomainController ( final XMLExtendedStreamWriter writer , final ModelNode modelNode ) throws XMLStreamException { } private void writeServers ( final XMLExtendedStreamWriter writer , final ModelNode modelNode ) throws XMLStreamException { } }

Fix:
if ( modelNode . hasDefined ( NAME ) ) {