Buggy code:
public class SecuritySubsystemParser implements XMLStreamConstants , ModulesMap , XMLElementReader < List < ModelNode > > , XMLElementWriter < SubsystemMarshallingContext > { private static final SecuritySubsystemParser INSTANCE = new SecuritySubsystemParser ( ) ; private Map < String , Integer > moduleNames ; public static SecuritySubsystemParser getInstance ( ) { } private SecuritySubsystemParser ( ) { } @ Override public void readElement ( XMLExtendedStreamReader reader , List < ModelNode > list ) throws XMLStreamException { } @ Override public void writeContent ( XMLExtendedStreamWriter writer , SubsystemMarshallingContext context ) throws XMLStreamException { } private void writeSecurityDomainContent ( XMLExtendedStreamWriter writer , ModelNode policyDetails ) throws XMLStreamException { } private void writeAuthentication ( XMLExtendedStreamWriter writer , ModelNode modelNode ) throws XMLStreamException { } private void writeAuthorization ( XMLExtendedStreamWriter writer , ModelNode modelNode ) throws XMLStreamException { } private void writeACL ( XMLExtendedStreamWriter writer , ModelNode modelNode ) throws XMLStreamException { } private void writeAudit ( XMLExtendedStreamWriter writer , ModelNode modelNode ) throws XMLStreamException { } private void writeIdentityTrust ( XMLExtendedStreamWriter writer , ModelNode modelNode ) throws XMLStreamException { if ( ( modelNode . isDefined ( ) ) && ( ( modelNode . asInt ( ) ) > 0 ) ) { writer . writeStartElement ( IDENTITY_TRUST . getLocalName ( ) ) ; <START_BUG> writeLoginModule ( writer , modelNode , TRUST_MODULE ) ; <END_BUG> writer . writeEndElement ( ) ; } } private void writeMapping ( XMLExtendedStreamWriter writer , ModelNode modelNode ) throws XMLStreamException { } private void writeAuthenticationJaspi ( XMLExtendedStreamWriter writer , ModelNode modelNode ) throws XMLStreamException { } private void writeLoginModuleStack ( XMLExtendedStreamWriter writer , ModelNode modelNode ) throws XMLStreamException { } private void writeLoginModule ( XMLExtendedStreamWriter writer , ModelNode modelNode , String key ) throws XMLStreamException { } private void writeLoginModule ( XMLExtendedStreamWriter writer , ModelNode modelNode , String key , final String elementName ) throws XMLStreamException { } private void writeJSSE ( XMLExtendedStreamWriter writer , ModelNode modelNode ) throws XMLStreamException { } private void parseSecurityManagement ( final XMLExtendedStreamReader reader , final ModelNode operation ) throws XMLStreamException { } private List < ModelNode > parseSecurityDomains ( final XMLExtendedStreamReader reader , final PathAddress parentAddress ) throws XMLStreamException { } private void parseSecurityDomain ( List < ModelNode > list , XMLExtendedStreamReader reader , PathAddress parentAddress ) throws XMLStreamException { } private void parseAuthentication ( List < ModelNode > list , PathAddress parentAddress , XMLExtendedStreamReader reader ) throws XMLStreamException { } private void parseLoginModules ( XMLExtendedStreamReader reader , PathAddress parentAddress , List < ModelNode > list ) throws XMLStreamException { } private ModelNode appendAddOperation ( List < ModelNode > list , PathAddress parentAddress , String name , String value ) { } private ModelNode createAddOperation ( PathAddress parentAddress , String name , String value ) { } private void parseAuthorization ( List < ModelNode > list , PathAddress parentAddress , XMLExtendedStreamReader reader ) throws XMLStreamException { } private void parseACL ( List < ModelNode > list , PathAddress parentAddress , XMLExtendedStreamReader reader ) throws XMLStreamException { } private void parseAudit ( List < ModelNode > list , PathAddress parentAddress , XMLExtendedStreamReader reader ) throws XMLStreamException { } private void parseIdentityTrust ( List < ModelNode > list , PathAddress parentAddress , XMLExtendedStreamReader reader ) throws XMLStreamException { } private void parseMapping ( List < ModelNode > list , PathAddress parentAddress , XMLExtendedStreamReader reader ) throws XMLStreamException { } private void parseCommonModule ( XMLExtendedStreamReader reader , final PathAddress parentAddress , final String keyName , EnumSet < Attribute > required , EnumSet < Attribute > notAllowed , List < ModelNode > list ) throws XMLStreamException { } private void parseAuthenticationJaspi ( List < ModelNode > list , PathAddress parentAddress , XMLExtendedStreamReader reader ) throws XMLStreamException { } private void parseAuthModule ( List < ModelNode > list , XMLExtendedStreamReader reader , PathAddress parentAddress ) throws XMLStreamException { } private void parseLoginModuleStack ( List < ModelNode > list , PathAddress parentAddress , XMLExtendedStreamReader reader ) throws XMLStreamException { } private void parseProperties ( String childElementName , XMLExtendedStreamReader reader , ModelNode node , PropertiesAttributeDefinition attribute ) throws XMLStreamException { } private void parseJSSE ( List < ModelNode > list , PathAddress parentAddress , XMLExtendedStreamReader reader ) throws XMLStreamException { } }

Fix:
writeLoginModule ( writer , modelNode , TRUST_MODULE , Element . TRUST_MODULE . getLocalName ( ) ) ;