Program: 64101
Project: 64101
Buggy source:
private void parseEvent(XMLStreamReader xmlStreamReader,int eventType) throws SAXException {
switch (eventType) {
case XMLStreamReader.START_ELEMENT:
{
      depth++;
      String localName=xmlStreamReader.getLocalName();
      String namespaceURI=xmlStreamReader.getNamespaceURI();
      if (Constants.EMPTY_STRING.equals(namespaceURI)) {
        namespaceURI=null;
      }
      if (qNameAware) {
        String prefix=xmlStreamReader.getPrefix();
        if (null == prefix || prefix.length() == 0) {
          contentHandler.startElement(namespaceURI,localName,localName,indexedAttributeList.reset());
        }
 else {
          contentHandler.startElement(namespaceURI,localName,prefix + Constants.COLON + localName,indexedAttributeList.reset());
        }
      }
 else {
        contentHandler.startElement(namespaceURI,localName,null,indexedAttributeList.reset());
      }
      break;
    }
case XMLStreamReader.END_ELEMENT:
{
    depth--;
    String localName=xmlStreamReader.getLocalName();
    String namespaceURI=xmlStreamReader.getNamespaceURI();
    if (Constants.EMPTY_STRING.equals(namespaceURI)) {
      namespaceURI=null;
    }
    if (qNameAware) {
      String prefix=xmlStreamReader.getPrefix();
      if (null == prefix || prefix.length() == 0) {
        contentHandler.endElement(namespaceURI,localName,localName);
      }
 else {
        contentHandler.endElement(namespaceURI,localName,prefix + Constants.COLON + localName);
      }
    }
 else {
      contentHandler.endElement(namespaceURI,localName,null);
    }
    break;
  }
case XMLStreamReader.PROCESSING_INSTRUCTION:
{
  contentHandler.processingInstruction(xmlStreamReader.getPITarget(),xmlStreamReader.getPIData());
  break;
}
case XMLStreamReader.CHARACTERS:
{
parseCharactersEvent(xmlStreamReader);
break;
}
case XMLStreamReader.COMMENT:
{
if (null != lexicalHandler) {
lexicalHandler.comment(xmlStreamReader.getTextCharacters(),xmlStreamReader.getTextStart(),xmlStreamReader.getTextLength());
}
break;
}
case XMLStreamReader.SPACE:
{
contentHandler.characters(xmlStreamReader.getTextCharacters(),xmlStreamReader.getTextStart(),xmlStreamReader.getTextLength());
break;
}
case XMLStreamReader.START_DOCUMENT:
{
depth++;
break;
}
case XMLStreamReader.END_DOCUMENT:
{
depth--;
return;
}
case XMLStreamReader.ENTITY_REFERENCE:
{
break;
}
case XMLStreamReader.ATTRIBUTE:
{
break;
}
case XMLStreamReader.DTD:
{
break;
}
case XMLStreamReader.CDATA:
{
char[] characters=xmlStreamReader.getText().toCharArray();
if (null == lexicalHandler) {
parseCharactersEvent(xmlStreamReader);
}
 else {
lexicalHandler.startCDATA();
parseCharactersEvent(xmlStreamReader);
lexicalHandler.endCDATA();
}
break;
}
}
}

Fixed version (ground truth):
private void parseEvent(XMLStreamReader xmlStreamReader,int eventType) throws SAXException {
switch (eventType) {
case XMLStreamReader.START_ELEMENT:
{
      depth++;
      int namespaceCount=xmlStreamReader.getNamespaceCount();
      if (namespaceCount > 0) {
        for (int x=0; x < namespaceCount; x++) {
          contentHandler.startPrefixMapping(xmlStreamReader.getNamespacePrefix(x),xmlStreamReader.getNamespaceURI(x));
        }
      }
      String localName=xmlStreamReader.getLocalName();
      String namespaceURI=xmlStreamReader.getNamespaceURI();
      if (Constants.EMPTY_STRING.equals(namespaceURI)) {
        namespaceURI=null;
      }
      if (qNameAware) {
        String prefix=xmlStreamReader.getPrefix();
        if (null == prefix || prefix.length() == 0) {
          contentHandler.startElement(namespaceURI,localName,localName,indexedAttributeList.reset());
        }
 else {
          contentHandler.startElement(namespaceURI,localName,prefix + Constants.COLON + localName,indexedAttributeList.reset());
        }
      }
 else {
        contentHandler.startElement(namespaceURI,localName,null,indexedAttributeList.reset());
      }
      break;
    }
case XMLStreamReader.END_ELEMENT:
{
    depth--;
    String localName=xmlStreamReader.getLocalName();
    String namespaceURI=xmlStreamReader.getNamespaceURI();
    if (Constants.EMPTY_STRING.equals(namespaceURI)) {
      namespaceURI=null;
    }
    if (qNameAware) {
      String prefix=xmlStreamReader.getPrefix();
      if (null == prefix || prefix.length() == 0) {
        contentHandler.endElement(namespaceURI,localName,localName);
      }
 else {
        contentHandler.endElement(namespaceURI,localName,prefix + Constants.COLON + localName);
      }
    }
 else {
      contentHandler.endElement(namespaceURI,localName,null);
    }
    int namespaceCount=xmlStreamReader.getNamespaceCount();
    if (namespaceCount > 0) {
      for (int x=0; x < namespaceCount; x++) {
        contentHandler.endPrefixMapping(xmlStreamReader.getNamespacePrefix(x));
      }
    }
    break;
  }
case XMLStreamReader.PROCESSING_INSTRUCTION:
{
  contentHandler.processingInstruction(xmlStreamReader.getPITarget(),xmlStreamReader.getPIData());
  break;
}
case XMLStreamReader.CHARACTERS:
{
parseCharactersEvent(xmlStreamReader);
break;
}
case XMLStreamReader.COMMENT:
{
if (null != lexicalHandler) {
lexicalHandler.comment(xmlStreamReader.getTextCharacters(),xmlStreamReader.getTextStart(),xmlStreamReader.getTextLength());
}
break;
}
case XMLStreamReader.SPACE:
{
contentHandler.characters(xmlStreamReader.getTextCharacters(),xmlStreamReader.getTextStart(),xmlStreamReader.getTextLength());
break;
}
case XMLStreamReader.START_DOCUMENT:
{
depth++;
break;
}
case XMLStreamReader.END_DOCUMENT:
{
depth--;
return;
}
case XMLStreamReader.ENTITY_REFERENCE:
{
break;
}
case XMLStreamReader.ATTRIBUTE:
{
break;
}
case XMLStreamReader.DTD:
{
break;
}
case XMLStreamReader.CDATA:
{
char[] characters=xmlStreamReader.getText().toCharArray();
if (null == lexicalHandler) {
parseCharactersEvent(xmlStreamReader);
}
 else {
lexicalHandler.startCDATA();
parseCharactersEvent(xmlStreamReader);
lexicalHandler.endCDATA();
}
break;
}
}
}