Buggy code:
private static void parseApplicationClassifications ( final XMLExtendedStreamReader reader , final ModelNode address , final Namespace expectedNs , final List < ModelNode > list ) throws XMLStreamException { } private static void parseApplicationClassification ( final XMLExtendedStreamReader reader , final ModelNode address , final Namespace expectedNs , final List < ModelNode > list ) throws XMLStreamException { } public static void parseServerGroupScopedRoles ( final XMLExtendedStreamReader reader , final ModelNode address , final Namespace expectedNs , final List < ModelNode > list ) throws XMLStreamException { } public static void parseHostScopedRoles ( final XMLExtendedStreamReader reader , final ModelNode address , final Namespace expectedNs , final List < ModelNode > list ) throws XMLStreamException { } private static void parseScopedRole ( XMLExtendedStreamReader reader , ModelNode address , Namespace expectedNs , List < ModelNode > ops , String scopedRoleType , final Element listElement , SimpleAttributeDefinition baseRoleDefinition , ListAttributeDefinition listDefinition , boolean requireChildren ) throws XMLStreamException { } public void writeManagement ( final XMLExtendedStreamWriter writer , final ModelNode management , boolean allowInterfaces ) throws XMLStreamException { } private static void writeAccessControl ( final XMLExtendedStreamWriter writer , final ModelNode accessAuthorization ) throws XMLStreamException { } private void writeSecurityRealm ( XMLExtendedStreamWriter writer , ModelNode management ) throws XMLStreamException { } private void writePlugIns ( XMLExtendedStreamWriter writer , ModelNode plugIns ) throws XMLStreamException { } private void writeServerIdentities ( XMLExtendedStreamWriter writer , ModelNode realm ) throws XMLStreamException { } private void writeAuthentication ( XMLExtendedStreamWriter writer , ModelNode realm ) throws XMLStreamException { writer . writeStartElement ( AUTHENTICATION . getLocalName ( ) ) ; ModelNode authentication = realm . require ( AUTHENTICATION ) ; if ( authentication . hasDefined ( TRUSTSTORE ) ) { ModelNode truststore = authentication . require ( TRUSTSTORE ) ; writer . writeEmptyElement ( Element . TRUSTSTORE . getLocalName ( ) ) ; KEYSTORE_PATH . marshallAsAttribute ( truststore , writer ) ; KEYSTORE_RELATIVE_TO . marshallAsAttribute ( truststore , writer ) ; KEYSTORE_PASSWORD . marshallAsAttribute ( truststore , writer ) ; } if ( authentication . hasDefined ( ModelDescriptionConstants . LOCAL ) ) { ModelNode local = authentication . require ( ModelDescriptionConstants . LOCAL ) ; writer . writeStartElement ( LOCAL . getLocalName ( ) ) ; DEFAULT_USER . marshallAsAttribute ( local , writer ) ; ALLOWED_USERS . marshallAsAttribute ( local , writer ) ; writer . writeEndElement ( ) ; } if ( authentication . hasDefined ( JAAS ) ) { ModelNode jaas = authentication . get ( JAAS ) ; writer . writeStartElement ( Element . JAAS . getLocalName ( ) ) ; NAME . marshallAsAttribute ( jaas , writer ) ; writer . writeEndElement ( ) ; } else if ( authentication . hasDefined ( LDAP ) ) { ModelNode userLdap = authentication . get ( LDAP ) ; writer . writeStartElement ( Element . LDAP . getLocalName ( ) ) ; CONNECTION . marshallAsAttribute ( userLdap , writer ) ; BASE_DN . marshallAsAttribute ( userLdap , writer ) ; RECURSIVE . marshallAsAttribute ( userLdap , writer ) ; USER_DN . marshallAsAttribute ( userLdap , writer ) ; ALLOW_EMPTY_PASSWORDS . marshallAsAttribute ( userLdap , writer ) ; if ( USERNAME_FILTER . isMarshallable ( userLdap ) ) { writer . writeEmptyElement ( Element . USERNAME_FILTER . getLocalName ( ) ) ; USERNAME_FILTER . marshallAsAttribute ( userLdap , writer ) ; } else if ( ADVANCED_FILTER . isMarshallable ( userLdap ) ) { writer . writeEmptyElement ( Element . ADVANCED_FILTER . getLocalName ( ) ) ; ADVANCED_FILTER . marshallAsAttribute ( userLdap , writer ) ; } writer . writeEndElement ( ) ; } else if ( authentication . hasDefined ( PROPERTIES ) ) { ModelNode properties = authentication . require ( PROPERTIES ) ; writer . writeEmptyElement ( Element . PROPERTIES . getLocalName ( ) ) ; PATH . marshallAsAttribute ( properties , writer ) ; RELATIVE_TO . marshallAsAttribute ( properties , writer ) ; PLAIN_TEXT . marshallAsAttribute ( properties , writer ) ; } else <START_BUG> if ( authentication . hasDefined ( USERS ) ) { <END_BUG> ModelNode userDomain = authentication . get ( USERS ) ; ModelNode users = ( userDomain . hasDefined ( USER ) ) ? userDomain . require ( USER ) : new ModelNode ( ) . setEmptyObject ( ) ; writer . writeStartElement ( Element . USERS . getLocalName ( ) ) ; for ( Property userProps : users . asPropertyList ( ) ) { String userName = userProps . getName ( ) ; ModelNode currentUser = userProps . getValue ( ) ; writer . writeStartElement ( Element . USER . getLocalName ( ) ) ; writer . writeAttribute ( USERNAME . getLocalName ( ) , userName ) ; PASSWORD . marshallAsElement ( currentUser , writer ) ; writer . writeEndElement ( ) ; } writer . writeEndElement ( ) ; } else if ( authentication . hasDefined ( ModelDescriptionConstants . PLUG_IN ) ) { writePlugIn_Authentication ( writer , authentication . get ( ModelDescriptionConstants . PLUG_IN ) ) ; } writer . writeEndElement ( ) ; } private void writePlugIn_Authentication ( XMLExtendedStreamWriter writer , ModelNode plugIn ) throws XMLStreamException { } private void writeAuthorization ( XMLExtendedStreamWriter writer , ModelNode realm ) throws XMLStreamException { } private void writeLdapAuthorization ( XMLExtendedStreamWriter writer , ModelNode ldapNode ) throws XMLStreamException { } private void writePlugIn_Authorization ( XMLExtendedStreamWriter writer , ModelNode plugIn ) throws XMLStreamException { } private void writeOutboundConnections ( XMLExtendedStreamWriter writer , ModelNode management ) throws XMLStreamException { } private void writeManagementInterfaces ( XMLExtendedStreamWriter writer , ModelNode management ) throws XMLStreamException { } private static Map < String , Map < String , Set < String > > > getConfiguredAccessConstraints ( ModelNode accessAuthorization ) { } private static Map < String , Map < String , Set < String > > > getVaultConstraints ( final ModelNode constraint ) { } private static Map < String , Map < String , Set < String > > > getSensitivityClassificationConstraints ( final ModelNode constraint ) { }

Fix:
if ( authentication . has ( USERS ) ) {