Program: 167795
Project: 167795
Buggy source:
void parseServerGroups(final XMLExtendedStreamReader reader,final ModelNode address,final Namespace expectedNs,final List<ModelNode> list) throws XMLStreamException {
  requireNoAttributes(reader);
  final Set<String> names=new HashSet<String>();
  while (reader.nextTag() != END_ELEMENT) {
    requireNamespace(reader,expectedNs);
    Element serverGroup=Element.forName(reader.getLocalName());
    if (Element.SERVER_GROUP != serverGroup) {
      throw unexpectedElement(reader);
    }
    String name=null;
    String profile=null;
    Boolean managementSubsystemEndpoint=null;
    final int count=reader.getAttributeCount();
    for (int i=0; i < count; i++) {
      final String value=reader.getAttributeValue(i);
      if (!isNoNamespaceAttribute(reader,i)) {
        throw ParseUtils.unexpectedAttribute(reader,i);
      }
 else {
        final Attribute attribute=Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case NAME:
{
            if (name != null) {
              throw ParseUtils.duplicateAttribute(reader,attribute.getLocalName());
            }
            if (!names.add(value)) {
              throw ParseUtils.duplicateNamedElement(reader,value);
            }
            name=value;
            break;
          }
case PROFILE:
{
          if (profile != null) {
            throw ParseUtils.duplicateAttribute(reader,attribute.getLocalName());
          }
          profile=value;
          break;
        }
case MANAGEMENT_SUBSYSTEM_ENDPOINT:
{
        if (managementSubsystemEndpoint != null) {
          throw ParseUtils.duplicateAttribute(reader,attribute.getLocalName());
        }
        managementSubsystemEndpoint=Boolean.valueOf(value);
        break;
      }
default :
    throw ParseUtils.unexpectedAttribute(reader,i);
}
}
}
if (name == null) {
throw missingRequired(reader,Collections.singleton(Attribute.NAME));
}
if (profile == null) {
throw missingRequired(reader,Collections.singleton(Attribute.PROFILE));
}
final ModelNode groupAddress=new ModelNode().set(address);
groupAddress.add(ModelDescriptionConstants.SERVER_GROUP,name);
final ModelNode group=new ModelNode();
group.get(OP).set(ADD);
group.get(OP_ADDR).set(groupAddress);
group.get(PROFILE).set(profile);
if (managementSubsystemEndpoint != null) {
group.get(MANAGEMENT_SUBSYSTEM_ENDPOINT).set(managementSubsystemEndpoint);
}
list.add(group);
boolean sawDeployments=false;
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
requireNamespace(reader,expectedNs);
final Element element=Element.forName(reader.getLocalName());
switch (element) {
case JVM:
{
  JvmXml.parseJvm(reader,groupAddress,expectedNs,list,new HashSet<String>());
  break;
}
case SOCKET_BINDING_GROUP:
{
parseSocketBindingGroupRef(reader,group,ServerGroupResourceDefinition.SOCKET_BINDING_GROUP,ServerGroupResourceDefinition.SOCKET_BINDING_PORT_OFFSET);
break;
}
case DEPLOYMENTS:
{
if (sawDeployments) {
throw MESSAGES.alreadyDefined(element.getLocalName(),reader.getLocation());
}
sawDeployments=true;
parseDeployments(reader,groupAddress,expectedNs,list,EnumSet.of(Attribute.NAME,Attribute.RUNTIME_NAME,Attribute.ENABLED),Collections.<Element>emptySet());
break;
}
case DEPLOYMENT_OVERLAYS:
{
parseDeploymentOverlays(reader,expectedNs,groupAddress,list);
break;
}
case SYSTEM_PROPERTIES:
{
parseSystemProperties(reader,groupAddress,expectedNs,list,false);
break;
}
default :
throw ParseUtils.unexpectedElement(reader);
}
}
}
}

Fixed version (ground truth):
void parseServerGroups(final XMLExtendedStreamReader reader,final ModelNode address,final Namespace expectedNs,final List<ModelNode> list) throws XMLStreamException {
  requireNoAttributes(reader);
  final Set<String> names=new HashSet<String>();
  while (reader.nextTag() != END_ELEMENT) {
    requireNamespace(reader,expectedNs);
    Element serverGroup=Element.forName(reader.getLocalName());
    if (Element.SERVER_GROUP != serverGroup) {
      throw unexpectedElement(reader);
    }
    String name=null;
    String profile=null;
    Boolean managementSubsystemEndpoint=null;
    final int count=reader.getAttributeCount();
    for (int i=0; i < count; i++) {
      final String value=reader.getAttributeValue(i);
      if (!isNoNamespaceAttribute(reader,i)) {
        throw ParseUtils.unexpectedAttribute(reader,i);
      }
 else {
        final Attribute attribute=Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case NAME:
{
            if (name != null) {
              throw ParseUtils.duplicateAttribute(reader,attribute.getLocalName());
            }
            if (!names.add(value)) {
              throw ParseUtils.duplicateNamedElement(reader,value);
            }
            name=value;
            break;
          }
case PROFILE:
{
          if (profile != null) {
            throw ParseUtils.duplicateAttribute(reader,attribute.getLocalName());
          }
          profile=value;
          break;
        }
case MANAGEMENT_SUBSYSTEM_ENDPOINT:
{
        if (managementSubsystemEndpoint != null) {
          throw ParseUtils.duplicateAttribute(reader,attribute.getLocalName());
        }
        managementSubsystemEndpoint=Boolean.valueOf(value);
        break;
      }
default :
    throw ParseUtils.unexpectedAttribute(reader,i);
}
}
}
if (name == null) {
throw missingRequired(reader,Collections.singleton(Attribute.NAME));
}
if (profile == null) {
throw missingRequired(reader,Collections.singleton(Attribute.PROFILE));
}
final ModelNode groupAddress=new ModelNode().set(address);
groupAddress.add(ModelDescriptionConstants.SERVER_GROUP,name);
final ModelNode group=new ModelNode();
group.get(OP).set(ADD);
group.get(OP_ADDR).set(groupAddress);
group.get(PROFILE).set(profile);
if (managementSubsystemEndpoint != null) {
group.get(MANAGEMENT_SUBSYSTEM_ENDPOINT).set(managementSubsystemEndpoint);
}
list.add(group);
boolean sawDeployments=false;
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
requireNamespace(reader,expectedNs);
final Element element=Element.forName(reader.getLocalName());
switch (element) {
case JVM:
{
  JvmXml.parseJvm(reader,groupAddress,expectedNs,list,new HashSet<String>());
  break;
}
case SOCKET_BINDING_GROUP:
{
parseSocketBindingGroupRef(reader,group,ServerGroupResourceDefinition.SOCKET_BINDING_GROUP,ServerGroupResourceDefinition.SOCKET_BINDING_PORT_OFFSET);
break;
}
case DEPLOYMENTS:
{
if (sawDeployments) {
throw MESSAGES.alreadyDefined(element.getLocalName(),reader.getLocation());
}
sawDeployments=true;
parseDeployments(reader,groupAddress,expectedNs,list,EnumSet.of(Attribute.NAME,Attribute.RUNTIME_NAME,Attribute.ENABLED),Collections.<Element>emptySet());
break;
}
case DEPLOYMENT_OVERLAYS:
{
parseDeploymentOverlays(reader,expectedNs,groupAddress,list,false,true);
break;
}
case SYSTEM_PROPERTIES:
{
parseSystemProperties(reader,groupAddress,expectedNs,list,false);
break;
}
default :
throw ParseUtils.unexpectedElement(reader);
}
}
}
}