Buggy code:
private static void parseAuthorization_2_0 ( final XMLExtendedStreamReader reader , final Namespace expectedNs , final ModelNode realmAdd , final List < ModelNode > list ) throws XMLStreamException { } private static void parsePropertiesAuthorization ( final XMLExtendedStreamReader reader , final ModelNode realmAddress , final List < ModelNode > list ) throws XMLStreamException { } private static void parsePlugIn_Authentication ( final XMLExtendedStreamReader reader , final Namespace expectedNs , final ModelNode parentAddress , final List < ModelNode > list ) throws XMLStreamException { } private static void parsePlugIn_Authorization ( final XMLExtendedStreamReader reader , final Namespace expectedNs , final ModelNode parentAddress , final List < ModelNode > list ) throws XMLStreamException { } private static void parseProperty ( final XMLExtendedStreamReader reader , final ModelNode parentAddress , final List < ModelNode > list ) throws XMLStreamException { } public static void parseAccessControlRoleMapping ( final XMLExtendedStreamReader reader , final ModelNode accContAddr , final Namespace expectedNs , final List < ModelNode > list ) throws XMLStreamException { } private static void parseRole ( final XMLExtendedStreamReader reader , final ModelNode address , final Namespace expectedNs , final List < ModelNode > list ) throws XMLStreamException { } private static void parseIncludeExclude ( final XMLExtendedStreamReader reader , final ModelNode address , final Namespace expectedNs , final List < ModelNode > list ) throws XMLStreamException { } private static void parsePrincipal ( final XMLExtendedStreamReader reader , final ModelNode address , final String type , final Namespace expectedNs , final List < ModelNode > list ) throws XMLStreamException { } public static void parseAccessControlConstraints ( final XMLExtendedStreamReader reader , final ModelNode accAuthzAddr , final Namespace expectedNs , final List < ModelNode > list ) throws XMLStreamException { } private static void parseSensitiveClassifications ( final XMLExtendedStreamReader reader , final ModelNode address , final Namespace expectedNs , final List < ModelNode > list ) throws XMLStreamException { } private static void parseClassification ( final XMLExtendedStreamReader reader , final ModelNode address , final Namespace expectedNs , final List < ModelNode > list ) throws XMLStreamException { } private static void parseClassificationType ( final XMLExtendedStreamReader reader , final ModelNode address , final Namespace expectedNs , final List < ModelNode > list , boolean vault ) throws XMLStreamException { } private static void parseApplicationTypes ( final XMLExtendedStreamReader reader , final ModelNode address , final Namespace expectedNs , final List < ModelNode > list ) throws XMLStreamException { } private static void parseApplicationType ( final XMLExtendedStreamReader reader , final ModelNode address , final Namespace expectedNs , final List < ModelNode > list ) throws XMLStreamException { } private static void parseApplicationTypeType ( 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 { } private void writePlugIn_Authentication ( XMLExtendedStreamWriter writer , ModelNode plugIn ) throws XMLStreamException { } private void writeAuthorization ( XMLExtendedStreamWriter writer , ModelNode realm ) 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 ) { } private static Map < String , Map < String , Set < String > > > getApplicationTypeConstraints ( final ModelNode constraint ) { } private static void writeRoleMapping ( XMLExtendedStreamWriter writer , ModelNode accessAuthorization ) throws XMLStreamException { } private static void writeIncludeExclude ( XMLExtendedStreamWriter writer , String elementName , ModelNode includeExclude ) throws XMLStreamException { } private static void writePrincipal ( XMLExtendedStreamWriter writer , ModelNode principal ) throws XMLStreamException { <START_BUG> String elementName = ( principal . require ( TYPE ) . asString ( ) . equals ( GROUP ) ) ? Element . GROUP . getLocalName ( ) : USER . getLocalName ( ) ; <END_BUG> writer . writeStartElement ( elementName ) ; REALM . marshallAsAttribute ( principal , writer ) ; NAME . marshallAsAttribute ( principal , writer ) ; writer . writeEndElement ( ) ; } private static void writeAccessConstraints ( XMLExtendedStreamWriter writer , ModelNode accessAuthorization , Map < String , Map < String , Set < String > > > configuredConstraints ) throws XMLStreamException { } private static void writeServerGroupScopedRoles ( XMLExtendedStreamWriter writer , ModelNode scopedRoles ) throws XMLStreamException { } private static void writeHostScopedRoles ( XMLExtendedStreamWriter writer , ModelNode scopedRoles ) throws XMLStreamException { } private static void writeAttribute ( XMLExtendedStreamWriter writer , Attribute attribute , String value ) throws XMLStreamException { } }

Fix:
String elementName = ( principal . require ( TYPE ) . asString ( ) . equalsIgnoreCase ( GROUP ) ) ? Element . GROUP . getLocalName ( ) : USER . getLocalName ( ) ;