Program: 67048
Project: 67048
Buggy source:
private void parse(XMLStreamReader xmlStreamReader) throws SAXException {
  if (null == getContentHandler()) {
    return;
  }
switch (xmlStreamReader.getEventType()) {
case XMLStreamReader.ATTRIBUTE:
{
      break;
    }
case XMLStreamReader.CDATA:
{
    if (null == lexicalHandler) {
      getContentHandler().characters(xmlStreamReader.getTextCharacters(),xmlStreamReader.getTextStart(),xmlStreamReader.getTextLength());
    }
 else {
      lexicalHandler.startCDATA();
      getContentHandler().characters(xmlStreamReader.getTextCharacters(),xmlStreamReader.getTextStart(),xmlStreamReader.getTextLength());
      lexicalHandler.endCDATA();
    }
    break;
  }
case XMLStreamReader.CHARACTERS:
{
  getContentHandler().characters(xmlStreamReader.getTextCharacters(),xmlStreamReader.getTextStart(),xmlStreamReader.getTextLength());
  break;
}
case XMLStreamReader.COMMENT:
{
if (null != lexicalHandler) {
  lexicalHandler.comment(xmlStreamReader.getTextCharacters(),xmlStreamReader.getTextStart(),xmlStreamReader.getTextLength());
}
break;
}
case XMLStreamReader.DTD:
{
break;
}
case XMLStreamReader.END_DOCUMENT:
{
depth--;
getContentHandler().endDocument();
return;
}
case XMLStreamReader.END_ELEMENT:
{
depth--;
String prefix=xmlStreamReader.getPrefix();
if (null == prefix || prefix.length() == 0) {
getContentHandler().endElement(xmlStreamReader.getNamespaceURI(),xmlStreamReader.getLocalName(),xmlStreamReader.getLocalName());
}
 else {
getContentHandler().endElement(xmlStreamReader.getNamespaceURI(),xmlStreamReader.getLocalName(),prefix + XMLConstants.COLON + xmlStreamReader.getLocalName());
}
break;
}
case XMLStreamReader.ENTITY_DECLARATION:
{
break;
}
case XMLStreamReader.ENTITY_REFERENCE:
{
break;
}
case XMLStreamReader.NAMESPACE:
{
break;
}
case XMLStreamReader.NOTATION_DECLARATION:
{
break;
}
case XMLStreamReader.PROCESSING_INSTRUCTION:
{
getContentHandler().processingInstruction(xmlStreamReader.getPITarget(),xmlStreamReader.getPIData());
break;
}
case XMLStreamReader.SPACE:
{
char[] characters=xmlStreamReader.getTextCharacters();
getContentHandler().characters(characters,0,characters.length);
break;
}
case XMLStreamReader.START_DOCUMENT:
{
depth++;
getContentHandler().startDocument();
break;
}
case XMLStreamReader.START_ELEMENT:
{
depth++;
String prefix=xmlStreamReader.getPrefix();
if (null == prefix || prefix.length() == 0) {
getContentHandler().startElement(xmlStreamReader.getNamespaceURI(),xmlStreamReader.getLocalName(),xmlStreamReader.getLocalName(),new IndexedAttributeList(xmlStreamReader));
}
 else {
getContentHandler().startElement(xmlStreamReader.getNamespaceURI(),xmlStreamReader.getLocalName(),prefix + XMLConstants.COLON + xmlStreamReader.getLocalName(),new IndexedAttributeList(xmlStreamReader));
}
break;
}
}
try {
if (depth > 0 && xmlStreamReader.hasNext()) {
xmlStreamReader.next();
parse(xmlStreamReader);
}
}
 catch (XMLStreamException e) {
throw new RuntimeException(e);
}
}

Fixed version (ground truth):
private void parse(XMLStreamReader xmlStreamReader) throws SAXException {
  try {
    parseEvent(xmlStreamReader);
    while (depth > 0 && xmlStreamReader.hasNext()) {
      xmlStreamReader.next();
      parseEvent(xmlStreamReader);
    }
  }
 catch (  XMLStreamException e) {
    throw new RuntimeException(e);
  }
}