Program: 152679
Project: 152679
Buggy source:
public static TagMetaData parse(XMLStreamReader reader,Version version) throws XMLStreamException {
  TagMetaData tag=null;
switch (version) {
case TLD_1_1:
    tag=new Tag11MetaData();
  break;
case TLD_1_2:
tag=new Tag12MetaData();
break;
default :
tag=new TagMetaData();
}
final int count=reader.getAttributeCount();
for (int i=0; i < count; i++) {
final String value=reader.getAttributeValue(i);
if (attributeHasNamespace(reader,i)) {
continue;
}
final Attribute attribute=Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case ID:
{
tag.setId(value);
break;
}
default :
throw unexpectedAttribute(reader,i);
}
}
DescriptionGroupMetaData descriptionGroup=new DescriptionGroupMetaData();
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
if (DescriptionGroupMetaDataParser.parse(reader,descriptionGroup)) {
if (tag.getDescriptionGroup() == null) {
tag.setDescriptionGroup(descriptionGroup);
}
continue;
}
final Element element=Element.forName(reader.getLocalName());
switch (element) {
case NAME:
tag.setName(getElementText(reader));
break;
case TAG_CLASS:
tag.setTagClass(getElementText(reader));
break;
case TAGCLASS:
if (version == Version.TLD_1_1) {
tag.setTagClass(getElementText(reader));
}
 else if (version == Version.TLD_1_2) {
tag.setTagClass(getElementText(reader));
}
 else {
throw unexpectedElement(reader);
}
break;
case TEI_CLASS:
tag.setTeiClass(getElementText(reader));
break;
case TEICLASS:
if (version == Version.TLD_1_1) {
tag.setTeiClass(getElementText(reader));
}
 else if (version == Version.TLD_1_2) {
tag.setTeiClass(getElementText(reader));
}
 else {
throw unexpectedElement(reader);
}
break;
case BODY_CONTENT:
tag.setBodyContent(BodyContentType.valueOf(getElementText(reader)));
break;
case BODYCONTENT:
if (version == Version.TLD_1_1) {
tag.setBodyContent(BodyContentType.valueOf(getElementText(reader)));
}
 else if (version == Version.TLD_1_2) {
tag.setBodyContent(BodyContentType.valueOf(getElementText(reader)));
}
 else {
throw unexpectedElement(reader);
}
break;
case INFO:
if (version == Version.TLD_1_1) {
((Tag11MetaData)tag).setInfo(getElementText(reader));
}
 else if (version == Version.TLD_1_2) {
getElementText(reader);
}
 else {
throw unexpectedElement(reader);
}
break;
case SMALL_ICON:
if (version == Version.TLD_1_2) {
((Tag12MetaData)tag).setSmallIcon(getElementText(reader));
}
 else {
throw unexpectedElement(reader);
}
break;
case LARGE_ICON:
if (version == Version.TLD_1_2) {
((Tag12MetaData)tag).setLargeIcon(getElementText(reader));
}
 else {
throw unexpectedElement(reader);
}
break;
case VARIABLE:
List<VariableMetaData> variables=tag.getVariables();
if (variables == null) {
variables=new ArrayList<VariableMetaData>();
tag.setVariables(variables);
}
variables.add(VariableMetaDataParser.parse(reader));
break;
case ATTRIBUTE:
List<AttributeMetaData> attributes=tag.getAttributes();
if (attributes == null) {
attributes=new ArrayList<AttributeMetaData>();
tag.setAttributes(attributes);
}
attributes.add(AttributeMetaDataParser.parse(reader));
break;
case DYNAMIC_ATTRIBUTES:
tag.setDynamicAttributes(getElementText(reader));
break;
case EXAMPLE:
List<String> examples=tag.getExamples();
if (examples == null) {
examples=new ArrayList<String>();
tag.setExamples(examples);
}
examples.add(getElementText(reader));
break;
case TAG_EXTENSION:
List<TldExtensionMetaData> extensions=tag.getTagExtensions();
if (extensions == null) {
extensions=new ArrayList<TldExtensionMetaData>();
tag.setTagExtensions(extensions);
}
extensions.add(TldExtensionMetaDataParser.parse(reader));
break;
default :
throw unexpectedElement(reader);
}
}
return tag;
}

Fixed version (ground truth):
public static TagMetaData parse(XMLStreamReader reader,Version version) throws XMLStreamException {
  TagMetaData tag=null;
switch (version) {
case TLD_1_1:
    tag=new Tag11MetaData();
  break;
case TLD_1_2:
tag=new Tag12MetaData();
break;
default :
tag=new TagMetaData();
}
final int count=reader.getAttributeCount();
for (int i=0; i < count; i++) {
final String value=reader.getAttributeValue(i);
if (attributeHasNamespace(reader,i)) {
continue;
}
final Attribute attribute=Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case ID:
{
tag.setId(value);
break;
}
default :
throw unexpectedAttribute(reader,i);
}
}
DescriptionGroupMetaData descriptionGroup=new DescriptionGroupMetaData();
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
if (DescriptionGroupMetaDataParser.parse(reader,descriptionGroup)) {
if (tag.getDescriptionGroup() == null) {
tag.setDescriptionGroup(descriptionGroup);
}
continue;
}
final Element element=Element.forName(reader.getLocalName());
switch (element) {
case NAME:
tag.setName(getElementText(reader));
break;
case TAG_CLASS:
tag.setTagClass(getElementText(reader));
break;
case TAGCLASS:
if (version == Version.TLD_1_1) {
tag.setTagClass(getElementText(reader));
}
 else if (version == Version.TLD_1_2) {
tag.setTagClass(getElementText(reader));
}
 else {
throw unexpectedElement(reader);
}
break;
case TEI_CLASS:
tag.setTeiClass(getElementText(reader));
break;
case TEICLASS:
if (version == Version.TLD_1_1) {
tag.setTeiClass(getElementText(reader));
}
 else if (version == Version.TLD_1_2) {
tag.setTeiClass(getElementText(reader));
}
 else {
throw unexpectedElement(reader);
}
break;
case BODY_CONTENT:
try {
tag.setBodyContent(BodyContentType.valueOf(getElementText(reader)));
}
 catch (IllegalArgumentException e) {
throw unexpectedValue(reader,e);
}
break;
case BODYCONTENT:
if (version == Version.TLD_1_1) {
try {
tag.setBodyContent(BodyContentType.valueOf(getElementText(reader)));
}
 catch (IllegalArgumentException e) {
throw unexpectedValue(reader,e);
}
}
 else if (version == Version.TLD_1_2) {
try {
tag.setBodyContent(BodyContentType.valueOf(getElementText(reader)));
}
 catch (IllegalArgumentException e) {
throw unexpectedValue(reader,e);
}
}
 else {
throw unexpectedElement(reader);
}
break;
case INFO:
if (version == Version.TLD_1_1) {
((Tag11MetaData)tag).setInfo(getElementText(reader));
}
 else if (version == Version.TLD_1_2) {
getElementText(reader);
}
 else {
throw unexpectedElement(reader);
}
break;
case SMALL_ICON:
if (version == Version.TLD_1_2) {
((Tag12MetaData)tag).setSmallIcon(getElementText(reader));
}
 else {
throw unexpectedElement(reader);
}
break;
case LARGE_ICON:
if (version == Version.TLD_1_2) {
((Tag12MetaData)tag).setLargeIcon(getElementText(reader));
}
 else {
throw unexpectedElement(reader);
}
break;
case VARIABLE:
List<VariableMetaData> variables=tag.getVariables();
if (variables == null) {
variables=new ArrayList<VariableMetaData>();
tag.setVariables(variables);
}
variables.add(VariableMetaDataParser.parse(reader));
break;
case ATTRIBUTE:
List<AttributeMetaData> attributes=tag.getAttributes();
if (attributes == null) {
attributes=new ArrayList<AttributeMetaData>();
tag.setAttributes(attributes);
}
attributes.add(AttributeMetaDataParser.parse(reader));
break;
case DYNAMIC_ATTRIBUTES:
tag.setDynamicAttributes(getElementText(reader));
break;
case EXAMPLE:
List<String> examples=tag.getExamples();
if (examples == null) {
examples=new ArrayList<String>();
tag.setExamples(examples);
}
examples.add(getElementText(reader));
break;
case TAG_EXTENSION:
List<TldExtensionMetaData> extensions=tag.getTagExtensions();
if (extensions == null) {
extensions=new ArrayList<TldExtensionMetaData>();
tag.setTagExtensions(extensions);
}
extensions.add(TldExtensionMetaDataParser.parse(reader));
break;
default :
throw unexpectedElement(reader);
}
}
return tag;
}