Program: 185122
Project: 185122
Buggy source:
private static String combineAdjacent(XMLStreamReader reader) throws XMLStreamException {
  String memory=null;
  java.io.StringWriter stringWriter=new java.io.StringWriter();
  XMLOutputFactory factory=XMLOutputFactory.newInstance();
  XMLStreamWriter writer=factory.createXMLStreamWriter(stringWriter);
  while (reader.hasNext()) {
    int event=reader.next();
switch (event) {
case XMLStreamConstants.END_ELEMENT:
      if (reader.getLocalName().equals("String_Node_Str")) {
        memory="String_Node_Str";
      }
 else       if (reader.getLocalName().equals("String_Node_Str")) {
        memory="String_Node_Str";
      }
 else {
        writer.writeEndElement();
      }
    break;
case XMLStreamConstants.START_ELEMENT:
  if (memory != null) {
    if (memory.equals(reader.getLocalName())) {
      memory=null;
      continue;
    }
 else {
      writer.writeEndElement();
      memory=null;
    }
  }
if (reader.getNamespaceURI() == null) {
  writer.writeStartElement(reader.getLocalName());
}
 else {
  writer.writeStartElement(reader.getPrefix(),reader.getLocalName(),reader.getNamespaceURI());
}
for (int i=0; i < reader.getAttributeCount(); i++) {
writer.writeAttribute(reader.getAttributePrefix(i),reader.getAttributeNamespace(i),reader.getAttributeLocalName(i),reader.getAttributeValue(i));
}
for (int i=0; i < reader.getNamespaceCount(); i++) {
writer.writeNamespace(reader.getNamespacePrefix(i),reader.getNamespaceURI(i));
}
break;
case XMLStreamConstants.CHARACTERS:
if (memory != null) {
writer.writeEndElement();
memory=null;
}
writer.writeCharacters(reader.getText());
break;
case XMLStreamConstants.START_DOCUMENT:
writer.writeStartDocument();
break;
case XMLStreamConstants.END_DOCUMENT:
writer.writeEndDocument();
break;
default :
}
}
writer.flush();
writer.close();
return stringWriter.toString();
}

Fixed version (ground truth):
private static String combineAdjacent(XMLStreamReader reader) throws XMLStreamException {
  String memory=null;
  java.io.StringWriter stringWriter=new java.io.StringWriter();
  XMLOutputFactory factory=XMLOutputFactory.newInstance();
  XMLStreamWriter writer=factory.createXMLStreamWriter(stringWriter);
  while (reader.hasNext()) {
    int event=reader.next();
switch (event) {
case XMLStreamConstants.END_ELEMENT:
      if (reader.getLocalName().equals("String_Node_Str")) {
        memory="String_Node_Str";
      }
 else       if (reader.getLocalName().equals("String_Node_Str")) {
        memory="String_Node_Str";
      }
 else {
        writer.writeEndElement();
      }
    break;
case XMLStreamConstants.START_ELEMENT:
  try {
    if (memory != null) {
      if (memory.equals(reader.getLocalName())) {
        memory=null;
        continue;
      }
 else {
        writer.writeEndElement();
        memory=null;
      }
    }
    if (reader.getNamespaceURI() == null) {
      writer.writeStartElement(reader.getLocalName());
    }
 else {
      writer.writeStartElement(reader.getPrefix(),reader.getLocalName(),reader.getNamespaceURI());
    }
    for (int i=0; i < reader.getAttributeCount(); i++) {
      if (reader.getAttributeNamespace(i) == null) {
        writer.writeAttribute(reader.getAttributeLocalName(i),reader.getAttributeValue(i));
      }
 else {
        writer.writeAttribute(reader.getAttributePrefix(i),reader.getAttributeNamespace(i),reader.getAttributeLocalName(i),reader.getAttributeValue(i));
      }
    }
    for (int i=0; i < reader.getNamespaceCount(); i++) {
      writer.writeNamespace(reader.getNamespacePrefix(i),reader.getNamespaceURI(i));
    }
  }
 catch (  XMLStreamException e) {
    System.out.println("String_Node_Str" + reader.getLocalName() + "String_Node_Str");
    e.printStackTrace();
    throw e;
  }
break;
case XMLStreamConstants.CHARACTERS:
if (memory != null) {
writer.writeEndElement();
memory=null;
}
writer.writeCharacters(reader.getText());
break;
case XMLStreamConstants.START_DOCUMENT:
writer.writeStartDocument();
break;
case XMLStreamConstants.END_DOCUMENT:
writer.writeEndDocument();
break;
default :
}
}
writer.flush();
writer.close();
return stringWriter.toString();
}